Accessibility

TechNote (Archived)

Using the Get URL Action to target a named anchor fails across framesets

Issue


Using a frame anchor with a getURL action can work correctly if the SWF and the target are in the same HTML frame. Targeting a different frame in the frameset loads the URL, but doesn't jump to the named anchor.

For example, the following action attempts to load the file "testpage.htm" in the frame named "main", then scroll the page to the anchor "#Fullscreen". This will not work correctly in all browsers.


Reason


This is a browser issue. Macromedia has not tested every browser combination, but this issue affects users of Netscape for Windows. Testing shows that Internet Explorer for Windows behaves correctly, as do both Internet Explorer 4.5 and Netscape Communicator for Macintosh.

The Macromedia Flash Player passes the complete string from the getURL action, including the "#anchor" information. However, the browser's plug-in programming interface is not correctly reading the anchor information.

Solution


Named anchors will work correctly if the SWF is in the same frame as the anchor.

One possible workaround is to call JavaScript functions using the getURL action. The JavaScript function then handles loading the URL to the frame. Instead of an "http://" URL, the prefix "javascript:" would be added to the function name to be called.However, this method is risky because not all browsers support Macromedia Flash Player and JavaScript communication. Specifically, this will not work with Internet Explorer 2.0 and 3.0 for Windows or Internet Explorer 4.5 Macintosh.

A sample getURL action could look like this:
getURL("javascript:window.location.href=\"filename.html#anchorname\"");

(note the escape characters \" in place of the quote characters)

For an example of using this syntax in Macromedia Flash (in this example to create pop-up windows) seeHow to create pop-up browser windows in Flash (TechNote 14192). This will show you the correct syntax inside a Flash movie.

Additional information
For more details on using anchors in Macromedia Flash, please refer to Why doesn't a Get URL Action load the URL correctly? (TechNote 12791).



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_14339
Browser:Chrome
Internet Explorer
Netscape
Opera
Safari
Firefox
Database:DB2
Informix
MySQL
Oracle
SQL Server
Sybase
MS Access

Products Affected: