E-mail Comment Del.icio.us Digg Reddit Technorati Furl

FLASH中弹窗口不被拦的方法

在flash中弹出新窗口,被拦,今天又遇到了。
在Flash中直接用navigateToURL();肯定是不行的,一定会被拦掉。
调JS的Window.open()也是不行的。
正确的方法是用JS模拟一个表单,把表单的target设为_blank.是可以成功,经过多种浏览器的试验,均可行。
在网页中放置JS代码

<script type="text/javascript">
function OpenNewWin(url)
{
	var frm=document.createElement("form");
    frm.method="POST";
    frm.target="_blank";
    frm.action=url;
    document.body.appendChild(frm);
    frm.submit();
}
</script>

在FLASH中调JS:ExternalInterface.call(“OpenNewWin”,”网址”);
即可。
如果出现JS错误,查一下Flash所在Object的ID有没有设。

4 Responses to “FLASH中弹窗口不被拦的方法”

  1. vily Says:

    navigateToURL();这种方法弹出窗口怎么会被拦截呢?除非用了什么安全限制。不然是不可能出现这种情况的。


  2. 阿平 Says:

    这样弹出就是不可以哎~~


  3. 匿名 Says:

    那是因为mode设置错误要设置成window


  4. eko Says:

    那是因为mode参数设置错误
    要设置成window


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">