Wednesday, August 8, 2007

Fixing the "base" attribute for Flash embedded in IE

Few days back my tech lead helped me to crack the problem of relative URL issue in embedding flash in HTML document. Normally if you embed a SWF file in a HTML document which is placed at different level of that SWF, and if you try to load external resources(image,swf) relative to the swf, then SWF will look for the resource relative to the HTML.

To solve this issue you should use base attribute in the EMBED tag. The base attrribute should point to the directory of SWF file. So once this is done, the SWF will load the external resources correctly.

And today when i checked this in great Internet Explorer, it didn't work. To be frank i was not stunned to see this. IE has always been a nightmare for the developers. Then i tried various workarounds. One workaround worked for me. IE doesn't compile the EMBED tag. It renders the output based on the OBJECT tag and the PARAM tag. So i added a new PARAM tag with NAME attribute as base and VALUE attribute points to the directory of SWF file.

So now i am a happy man :)

4 comments:

Anonymous said...

thanks! i needed something similar and your article helped me.

martin

Anonymous said...

Absolute life saver - thank you. :)

Bambi said...

helped me. thank you.

Bambi said...
This comment has been removed by the author.