18.11.2014 Views

WebExp2 Experimenter's Manual - School of Informatics - University ...

WebExp2 Experimenter's Manual - School of Informatics - University ...

WebExp2 Experimenter's Manual - School of Informatics - University ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 22: HTML to include the experimental applet in a web page.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Sorry, your browser is not Java enabled.<br />

<br />

6.4.2 Javascript and the browser<br />

The section <strong>of</strong> the applet tag definition between tags may appear confusing. This is a bit <strong>of</strong> javascript<br />

which will write another tag into the HTML, describing which browser the participant is using.<br />

The most reliable way <strong>of</strong> finding out what type <strong>of</strong> browser the participant is using is by querying the browser<br />

itself with javascript; it cannot be done in Java. This bit <strong>of</strong> code does that and writes the result to the HTML<br />

page so you get something like . The actual value is far more<br />

lengthy, but you can usually ascertain the source browser from the name near the end <strong>of</strong> the value, or failing<br />

that the generic name near the start.<br />

Therefore you don’t need to worry about this code or how it works, just include it if you want to know what<br />

browser is being used to view your experiment. The value is added to the results and recorded in the subject<br />

results file.<br />

6.4.3 Applet attributes and parameters<br />

When you include the tag in your webpage, there are two groups <strong>of</strong> settings to configure. Firstly there<br />

are the attributes <strong>of</strong> the applet, which are defined in the opening tag; these are properties which relate directly<br />

to the applet. Secondly there is the set <strong>of</strong> parameters, which define properties which the <strong>WebExp2</strong> client itself<br />

can read and use.<br />

Applet attributes The attributes define basic features <strong>of</strong> the applet. They are <strong>of</strong> the form attribute=”value”<br />

and are specified in the opening tag.<br />

To centre an applet horizontally in the page, surround the element with tags.<br />

The codebase attribute is only necessary if the root release directory (with the jar file and data) is different<br />

from the directory containing the webpage. If your webpages are hosted outside <strong>of</strong> the release directory, then<br />

you should specify the codebase attribute. For this reason, it is easiest when testing your experiments to place<br />

their supporting HTML pages in the release directory and run them from there, so the codebase tag does<br />

not need to be defined. Note that the webpages may be hosted separately from <strong>WebExp2</strong>, in which case the<br />

codebase should specify the full path <strong>of</strong> the server and directory containing <strong>WebExp2</strong>.<br />

43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!