`
gavin
  • 浏览: 82815 次
  • 性别: Icon_minigender_1
文章分类
社区版块
存档分类
最新评论

IE关闭有flash的页面js报错

阅读更多
IE关闭有flash的页面,js脚本报错,直接在IE里也没有报错,在用C++开发的桌面软件中使用了IE控件,浏览时才会出现这种情况,而且如果flash是本来就写在页面里的,也没问题,如果是后创建元素加到页面就有问题,比如用jquery的get方法取到html文本再append到页面上div里就有问题。可以确定是调用flash上开放的js方法出了问题,但是不知道是哪调的。结果找到这个页面,讲Flash ExternalInterface的问题。
关闭的问题:
引用
Internet Explorer Page Unload Bug
If you override the __flash__addCallback method (or are using Flash in an untraditional scenario like inside of a Microsoft Behavior), you can sometimes get exceptions when the page unloads on Internet Explorer. The source of this is the __flash__removeCallback method getting a null exception, which gets called as a page is unloaded. You can fix this by overriding this method and adding a better null check:

window.__flash__removeCallback =
   (function() {
      return function(instance, name) {
         if (instance) instance[name] = null;
      }; // IE 6 dangling semicolon needed
   )(); // force another closure to prevent IE memory leaks
Note that you should define this function after the Flash plugin has loaded, perhaps in a onDOMContentLoaded function. Otherwise Flash will overwrite your workaround with the original, faulty function.

以前遇到过调用的问题,后来用LocalConnection解决的,现在怀疑是不是下边的问题:
引用
Using Inside a Microsoft Behavior
If you are using a Microsoft Behavior in order to extend Internet Explorer's layout engine with JavaScript?, perhaps having the Flash object be 'hidden' from the external DOM using the ViewLink trick so developers don't see it but rather your new, custom tag instead (such as an SVG root element tag), ExternalInterface won't work correctly initially and your calls won't work.

The way to fix this is to get a reference to your Flash object first ('hiding' elements inside a Microsoft Behavior is detailed here); then simply have a variation of the method defined above in the Performance section to make your Flash methods callable; the only difference is we leave the eval() function in:

function makeCallable: function(flashObj, methodName) {
   // if we use the Behavior ViewLink trick to 'hide' the Flash object
   // from the external page's DOM (see FlashInserter._insertFlashIE for
   // the SCRIPT embedType), then Flash's ExternalInterface
   // doesn't work correctly.
   flashObj[methodName] =
      (function(methodName) {
         return function() {
            eval(this.CallFunction(
               '<invoke name="' + methodName + '" returntype="javascript">'
                  + __flash__argumentsToXML(arguments, 0)
               + '</invoke>'));
         }; // dangling semi-colon for IE 6
      })(methodName); // force re-closure to prevent IE memory leaks
}
If you do this, you will most certainly want to follow the instructions in "Internet Explorer Page Unload Bug" above as well.

里边还讲到:When you add a callback using ExternalInterface, that method actually internally uses eval() in order to turn strings into objects.利用这一点在有些时候可以提升调用的性能。
分享到:
评论

相关推荐

    clipboard复制文本或者隐藏域到剪切板,兼容ie.chrome.firefox

    利用clipboard.js,复制文本或者隐藏域到剪切板,没有flash限制,兼容ie.chrome.firefox

    Discuz! X3.4 繁体中文-PHP

    风格管理中新增操作结果混乱的问题40、修复 IE6、IE7等浏览器提示common.js报错的Bug41、修复 前台充值卡密页面不显示验证码和同一卡密充值2次成功的Bug42、【轻量级 PR】:修复门户”模块管理“菜单高亮相关BUG43...

    javascript编写 一笔画游戏解答程序

    使用js编写一笔画解答程序,代码有详细注释,推荐chrome运行,低版本ie请注释console语句,不然会报错。游戏地址:http://www.4399.com/flash/97076.htm最后一关已通过测试。空间有分析文章。

    编辑器 KindEditor 4.0.4

    Bugfix: [IE] 编辑器无内容,加粗,切换到代码模式,再回到可视化模式,加粗,JS报错。 Bugfix: [IE] 插入&lt;input value=”abc&quot;def”/&gt;,会自动变为 &lt;input value=”abc”def”/&gt;。 Bugfix: ...

    ExtAspNet_v2.3.2_dll

    -Grid增加GetNoSelectionAlertInParentReference函数,用来表示没有选中任何一项时在父页面弹出对话框的JS代码。 -修正IE7下不能以下划线作为CSS中类名的前缀的BUG(feedback:Steve.Wei)。 -添加定时器控件Timer,...

    NetGather企业建站系统 4.0.0.rar

    NetGather企业建站系统是结合asp ...为了更加有利于SEO的优化,我们尽量取消FLASH的运用,取而代之的就是JS效果,由于我们的HTML代码都是通过W3C认证的,所以JS效果很适合运用在我们的网站上,而不会有其他的冲突发生。

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -增加示例(iframe/parent_postback_run3.aspx),如何通过简单的Javascript代码回发父页面(feedback:eroach)。 -修正一些书写错误(feedback:bmck)。 -从Region控件中删除SplitColor属性,增加CollapseMode, ...

    dreamweaver的各种组件

    js depending on browser 根据不同的浏览器选择不同的javascript代码 Externel CSS file 插入外部的CSS文件 Externel Javascript file 插入外部的js文件 Video embed 插入activemovie windowsMaxmizer 最大化...

    Discuz! X1.5.1 简体GBK R20111221.zip

    Discuz X1.5是康盛创想Comsenz推出的一个以社区为基础的专业...FIX QQ互联: 修改论坛后台设置发帖不同步到空间或不同步到微博时,发帖页有js报错的问题 FIX 修改删除用户时的bug FIX 更新附件时的删除旧附件逻辑修正

    Discuz! X1.5.1 繁体BIG5 R20111221.zip

    Discuz X1.5是康盛创想Comsenz推出的一个以社区为基础的专业...FIX QQ互联: 修改论坛后台设置发帖不同步到空间或不同步到微博时,发帖页有js报错的问题 FIX 修改删除用户时的bug FIX 更新附件时的删除旧附件逻辑修正

    Discuz! X1.5.1 繁体UTF8 R20111221.zip

    Discuz X1.5是康盛创想Comsenz推出的一个以社区为基础的专业...FIX QQ互联: 修改论坛后台设置发帖不同步到空间或不同步到微博时,发帖页有js报错的问题 FIX 修改删除用户时的bug FIX 更新附件时的删除旧附件逻辑修正

    Discuz! X1.5.1 简体UTF-8 R20111221.zip

    Discuz X1.5是康盛创想Comsenz推出的一个以社区为基础的专业...FIX QQ互联: 修改论坛后台设置发帖不同步到空间或不同步到微博时,发帖页有js报错的问题 FIX 修改删除用户时的bug FIX 更新附件时的删除旧附件逻辑修正

    asoft签到管理系统tykq3.5_build20110125

    3、签到、请假查询、导出代码更替,现在可以不用开启JAVASCRIPT功能来进行页面导出了。 4、原绑定用户功能写数据库时增加对轮班字段的写入,增加轮班设定页面,现在您可以为任何一个用户设定单独的签到方式了,...

    PHPCMS 2008 SP2 正式版.zip

    54、 修正了黄页企业页面的联系方式栏目有"传真"和"邮编",但是没有地方填加这两项信息. 55、 修正了添加栏目多的话,程序执行缓慢 56、 内容分页有问题.第一页显示不了; [page]***[/page] 插入这样的分页符,第一...

    netgather企业建站系统 1.9s

    NetGather企业建站系统是结合asp+...为了更加有利于SEO的优化,我们尽量取消FLASH的运用,取而代之的就是JS效果,由于我们的HTML代码都是通过W3C认证的,所以JS效果很适合运用在我们的网站上,而不会有其他的冲突发生。

    Discuz! X3.4 正式版 简体中文 UTF8 v20200818

    40、修复 IE6、IE7等浏览器提示common.js报错的Bug 41、修复 前台充值卡密页面不显示验证码和同一卡密充值2次成功的Bug 42、【轻量级 PR】:修复门户”模块管理“菜单高亮相关BUG 43、【轻量级 PR】:修复target...

    Discuz! X3.4 简体中文-PHP

    40、修复 IE6、IE7等浏览器提示common.js报错的Bug 41、修复 前台充值卡密页面不显示验证码和同一卡密充值2次成功的Bug 42、【轻量级 PR】:修复门户”模块管理“菜单高亮相关BUG 43、【轻量级 PR】:修复target书写...

    惠信3.1a新闻系统更新无错版

    1、解决了IE报错的问题 2、解决了TOP的JS文件调用问题 3、解决了加入用户评论时文章阅读出错的问题 4、解决了文章阅读页回评论出错的问题 5、解决了后台管理评论错误 6、加入了凡凡公布的那个首页导航 7...

    asp.net知识库

    如何传值在2个页面之间 :要求不刷新父页面,并且不能用Querystring传值 Asp.net地址转义(分析)加强版 Web的桌面提醒(Popup) Using the Popup Object Click button only once in asp.net 2.0 Coalesys PanelBar ...

Global site tag (gtag.js) - Google Analytics