Accessibility

TechNote

Relative URLs are not referenced correctly in a Flash movie

Issue


Relative URLs do not work consistently with Flash movies played in browsers.

Reason


Relative URLs may be referenced incorrectly when the SWF file and the HTML file are in different locations.

Solution


If you are going to use relative URLs, then you should use the base attribute in the HTML <OBJECT> and <EMBED> tag to enforce the base location from which the URL loads. This prevents confusion about the location to which relative links are relative.

The base attribute in <OBJECT> and<EMBED> tags

The base attribute specifies the base directory or URL used in resolving all relative path statements in the Flash Player movie. This path can be absolute or relative where the default value is "." or the location of the SWF file.

Note: When you use the Active Content fix provided by Dreamweaver, the base attribute can be added to the generated code by including base and desired path into the arguments passed to AC_FL_RunContent().

The following is a very brief sample of code that uses a specific sample base:

<script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0', 'width','600','height','500','title','myMovie','src','myMovie','quality','high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','movie','test_CoilGalleryApp','base', 'http://www.example.com/pages/' ); //end AC code</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ><param name="movie" value="myMovie.swf"><param name="quality" value="high"><param name="base" value="http://www.example.com/pages/"><embed base="http://www.example.com/pages/" href="myMovie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ></embed></object></noscript>

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_04157

Products Affected:

flash