QED:Javascript
From QED
QED provides support for Javascript in QED pages in several ways:
- The <javascript> tag is supported for including Javascript source.
- External link syntax may be used with "javascript:" instead of "http:" as illustrated below.
- HTML tags, including <script>, may be incorporated on QED pages — see Help:HTML.
- A Javascript file (normally monobook.js) in the User: namespace will be read in. The name of the file depends on the selected "skin".
Contents |
<javascript>
The string <javascript>...</javascript> is equivalent to:
<script type="text/javascript"> ... </script>
In addition, the src attribute may be specified, so that the string <javascript src=FOO.js>...</javascript> is equivalent to:
<script type="text/javascript" src="FOO.js"> ... </script>
External link syntax
The following line:
Press [javascript:alert('here') here] for an alert.
produces:
Press here for an alert.
Note
If the external link syntax is used, certain characters in the javascript: string must be encoded. For example, the space character should be encoded as %20, so that [javascript:alert('here%20and%20there') here and there] produces here and there.
The following table shows the characters that must be encoded and their encodings:
| Character | % encoding |
|---|---|
| Space (" ") | %20 |
| Double quotation mark ('"') | %22 |
| Percent character ("%") | %25 |
| 'Less Than' symbol ("<") | %3c |
| 'Greater Than' symbol (">") | %3d |
| Left Square Bracket ("[") | %5b |
| Right Square Bracket ("]") | %5d |












