It is possible to add <script/> tags to your wiki source and they will be correctly rendered in the document <head/> tag upon page loading; also external scripts (using the src
attribute) will be parsed and activated, always respecting the order of declaration of the <script /> tags.
Use this code in a page, replacing SCRIPTNAME.JS with the name of your script:
This page contains this code:
- Create a text file in the same directory as this wiki.
- Paste this into the file:
alert("This is an example alert!");
- Save the file as example.js
- Reload the wiki.
- Open this page from the menu (not in the help pop-up) to run the example.js script and see the alert.
Use this code in a page, replacing CONTENT with your content, NAME with the page name, and LINK with the text you want the link to have:
To create a dynamically created temporary page.
Only one of these links may be used per page.
Paste each of these into a new page one by one to see what they do:
- This one uses the temporary page name as part of its content:
- This one demonstrates the use of various HTML tags in the content of the page:
The code below will redirect from the current page to the wiki page you specify a predefined number of seconds after the current page loads.
WARNING! Use this code carefully! Back up your wiki before trying it!
Use this code in a page, replacing PAGENAME with the name of the page to redirect to, and 10 with the number of seconds the script should delay:
To redirect the current page to the PAGENAME page 10 seconds after the current page loads.
Note that this will redirect to the next page even if you're in the editor! The only indication you will have if you're in the editor is that name in the the Page title box will change to the name of the redirected page. If you don't check this before saving, your changes will be saved to the redirected page, overwriting its contents.
It's a good idea to put this code near the top of any page (preferably directly beneath the first header on the page) so that you can find it quickly, and also to make the delay at least
10 seconds so that you have time to open the page in the editor, change the PAGENAME
portion of the code to a nonexistent page, and then save the page before the timer runs out.
Then you can reopen the page safely without risk of it redirecting while you're working on it. All that will happen if you give the script a nonexistent page name is that an alert will pop up asking if you'd like to create the nonexistent page. You can click Cancel
when that popup comes up and continue working without further interruption.
An even safer method is to open the wiki in a text editor and make changes to the page contents from there.
Use this code in a page:
<input type="button" value="Reload wiki" onClick="window.location.href=window.location.href">
To create a button that reloads the wiki when you click it.