获取当前URL在Flash中从JavaScript使用ExternalInterface的和IEFlash、URL、JavaScript、IE

2023-09-08 12:42:34 作者:吃瓜群众.

我试图让当前的URL,Flash播放器上。 .swf文件不是网址,但该浏览器指向的URL。到目前为止我用:

  VAR ST:字符串= ExternalInterface.call(window.location.href);
 

不幸的是,这并不在IE浏览器。从我的研究,我可以看到,它不会与IE浏览器两种方式。

唯一的其他事情,我发现在互联网是把标签上的'身份证'的标签。

所以我试图找出是否和/或如何,我可以:

     

不知怎的,拨打电话使用ExternalInterface在IE和其他   浏览器返回到我目前的   网址。

     

  

巴掌一个id =PA的标签属性,并AS3读取标签   而在拉它作为一个字符串,没有   使用JavaScript

  

我的限制是,我可以在标签只会增加HTML和不能添加任何JavaScript函数。这在AS3严格完成。

无论哪种方式,我需要知道我在哪个网址。任何帮助是极大的AP preciated。

解决方案 如何攻破一个网站

您需要以使其在IE浏览器两件事情。首先,动作:

  VAR域:字符串= ExternalInterface.call('函数(){返回window.location.href;}');
 

其次,你需要有效的的classid和id atributes在<对象> 标签:

 <对象的classid =CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000ID =myplayer_123123...>
 

如果你不把这些属性,ExternalInterface.call始终返回IE6 / 7/8空,但按预期在Firefox浏览器。

第三,你需要的参数的allowScriptAccess设置为总是,以允许使用ExternalInterface的了。

 < PARAM NAME =allowScriptAccess的价值='总是'/>
..
<嵌入的allowScriptAccess ='​​总是'...>
 

......

I'm trying to get the current URL that the Flash player is on. Not the URL of the .swf file, but the URL that the browser is pointing to. Thus far I've used:

var st:String = ExternalInterface.call("window.location.href");

Unfortunately this doesn't work in IE. From my research, I can see that it won't work with IE either way.

The only other thing I found around the Internet is putting an 'id' tag on the tag.

So I'm trying to find out if and/or how I can:

Somehow make a call using the ExternalInterface in IE and other browsers to return to me the current URL.

OR

Slap an id="PA" attribute on the tag and have AS3 read that tag and pull it in as a String, without using JavaScript

My limitation is that I can ONLY add the tag to the HTML and cannot add any JavaScript functions. This has to be strictly done in AS3.

Either way, I need to know what URL I'm on. Any help is greatly appreciated.

解决方案

You need a couple of things in order to make it work in IE. First the ActionScript:

var domain:String = ExternalInterface.call('function () { return window.location.href; }');

Second, you need valid classid and id atributes in the <object> tag:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="myplayer_123123" ...>

If you don't put those attributes, ExternalInterface.call always returns null in IE6/7/8 but works as expected in firefox.

Third, you need to set the param allowScriptAccess to 'always', in order to enable the use of ExternalInterface.

<param name='allowScriptAccess' value='always'/>
..
<embed allowscriptaccess='always' ...>

.....