开发者

Getting window.location in embedded Flash

开发者 https://www.devze.com 2023-02-12 08:07 出处:网络
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();}\";

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).

Getting window.location in embedded Flash

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消