Links

From MegaZine3
Jump to: navigation, search
Plugin: Links
Name Links
Files
  • links.swf
Related plugins

This plugin allows to apply linking on elements. A link can be a normal link to another webpage (e.g. http://www.example.com/) or another supported protocol. A protocol is defined by the beginning of the link. The example one is defined by the http:// part. The supported (by passing them on to a browser) protocols are:

Advanced protocol support may be added by other plugins, which register a handler for a protocol. Examples are the anchors and JavaScript plugins, which register the protocols anchor: and javascript:, respectively. See those plugins' documentation for more information on said protocols.

Contents

Plugin interactions

The titles and overlays plugins add, when loaded, some advanced functionality to links, such as highlighting (overlay) and a tooltip with the url to which the link leads (title). This can be suppressed by assigning the respective attribute a blank value (overlay="" / title=""). If the overlays plugin is loaded, this plugin can automatically add a border overlay to linked elements. This can be suppressed by individually assigning the linked element an empty overlay attribute (overlay=""), or globally by setting the book@overlaylinks attribute to false.

Settings

linksdefaulturi

Setting this attribute can help to build a valid URI in case the URL sent to the LINKS plugin was not detected as valid protocol handled by FLASH's standard navigateToUrl handler or as special protocol 'silent:'.

To also handle links that had been set in a PDF file that points to a local file, the links@linksdefaulturi parameter together with the links@linkspath parameter can be set accordingly.

Supported values for this attribute:

The string defined with links@linkspath is prepended to the URL and then passed as URI to navigateToUrl. If the URL starts with a '/' character, the path is made absolute if needed. The links@linkspath attribute can e.g. define the base path of the folder with all content referred to in the PDF file.

The URL is passed to navigateToUrl as URI (after prepending the basepath, in case the URL starts with a single '/'), without making use of links@linkspath

The URL is prepended with 'file:///' and then used with navigateToUrl

The URL is used as URI without any changes. Useful, if the URL contains a schema name not defined as standard protocol within the links plugin.

linkspath

A path fragment with or without schema name that will be prepended to the URL in case of links@linksdefaulturi is set to "auto"

linksoverlay

Determines whether to automatically create overlays for linked elements or not.

Attributes

Element

url

A URL to which to link. This will only be resolved if the protocol is supported, either by the links plugin itself, or another loaded plugin which registered a protocol.

target

Name of the target frame to open the link in. This may be ignored by some protocol handlers (such as the anchors). For normal web-links it'll work like the ActionScript's navigateToURL function's window parameter.

Examples

<book plugins="titles,links,javascript">
    <chapter>
        <page>
            <img src="google.jpg" url="http://www.google.com/"/>
            <img top="200" src="bing.jpg" title="This links to bing." url="http://www.bing.com/"/>
            <img top="400" src="js.jpg" url="javascript:alert('Hi there!');"/>
        </page>
    </chapter>
</book>

Problems

At least some users have expressed difficulty using links on local copies. Try putting your book on a webserver if your links aren't working.

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
Personal tools
Namespaces
Variants
Actions
Navigation
documentation
miscellaneous
Toolbox