JavaScript
| Name | JavaScript |
|---|---|
| Files |
|
| Related plugins |
The JavaScript plugin introduces a common interface for the engine and other plugins to communicate with JavaScript, should the engine run in a browser. It provides two interfaces, one for itself, so that other plugins can access it, and one other plugins can implement so they can add themselves to the list of JavaScript aware plugins. All registered plugins will be notified when the JavaScript plugin's setting "jsenabled" is set to true.
All plugins should use this way when offering JavaScript functionality, to allow a common behavior and centralized way of controlling the use of JavaScript.
Contents |
[edit] Plugin interactions
The JavaScript plugin registers a protocol with the links plugin, if loaded. The registered protocol is javascript: and can be used to run JavaScript code if the book is displayed using a browser. Example usage:
<element url="javascript:alert('test');"/>
[edit] Settings
jsenabled
- Type: Boolean
- Default:
true - Aliases: enablejs
This setting can be used to globally enable or disable JavaScript interaction of the book. As all plugins should use this plugin for registering and enabling JavaScript functionality, this will control the use of any JavaScript use at all, meaning if set to false it can be guaranteed (when using "nice" plugins) that there will indeed be no JavaScript interaction used.
[edit] Attributes
This plugin handles no attributes.
[edit] Examples
<book plugins="javascript,swfaddress,links"> <chapter> <page> <img src="test.jpg" url="javascript:alert('Hello World!');"/> </page> <!-- ... --> </chapter> </book>
| MegaZine3 Plugin-related articles | |
|---|---|
| Plugins | Anchors · Background Sounds · Batchpages · Bookmarks · Console · ElementIDs · Gallery · Google Analytics · Help · JavaScript · Keyboard Navigation · Links · NavigationBar · Options · Overlays · Password · PDFLinks · Print · PrintPDF · SWFAddress· Search · Sidebar · Slideshow · Titles |
| Plugin Articles | Writing a plugin · Writing a plugin II · Plugin development |