Getting window.location in embedded Flash
I embed a .swf file in HTML and then embed this HTML itself in another HTML.
In the .swf file I call
ExternalInterface.call(" function(){ return window.location.toString();}";
The problem is sometimes I seem to get window location of the embedded HTML and sometimes I get address of the main HTML (see picture).
All I am after is reliability. I want to get the same address everytime. I haven't eve开发者_JAVA技巧n been able to understand when it get which location. I wonder if it is some sort of browser related mystery!
Thanks for any help
Cheers!Ali
Using window.top.location.href
should always give you the address the user sees in their location bar. Be wary of using .toString()
on DOM objects in older versions of Internet Explorer.
精彩评论