javascript - Flash 对象未正确嵌入 IE 中

标签 javascript jquery html flash

我下载了这个 jquery 小样本 http://plugins.jquery.com/project/WebcamQRCode它是一个网页插件,它显示一个 Flash 播放器,通过网络摄像头捕获二维码。它在 Firefox 和 Chrome 中显示 Flash 播放器,但在 IE 中不显示。我在 IE 中有 flash 播放器,因为我尝试了此网页 http://blog.jactionscripters.com/2009/05/23/introduction-of-qr-code-reader-library 中的项目/并且它确实显示了二维码。

有人告诉我检查它是否是使用 swfobject 嵌入的,我检查了项目的 .js 文件,它正在将其嵌入为 swfobject,有人可以帮助我确定问题可能是什么吗?

这是 jqery.webcamqrcode.js 中代码的一部分

  $.WebcamQRCode.start = function( $this ){
        var _flash = $('<object></object>');
        var _messageNoFlash = $('<p></p>');
        var __options = $this.data( 'webcam_qrcode_options' );

        // Set message if no flash
        _messageNoFlash.text( __options.messageNoFlash );

        // Set flash object information
        _flash.attr( 'type', "application/x-shockwave-flash" );
        _flash.attr( 'data', __options.path + "swf/webcamqrcode.swf?ID=" + $this.attr( '_webcam_qrcode_id' ) );
        _flash.attr( 'width', "100%" );
        _flash.attr( 'height', "100%" );
        _flash.append( _messageNoFlash );

        $this.html( _flash );
    }

谢谢!

最佳答案

IE 需要 <param name="movie" value="blah.swf"> ,您应该将其附加到 _flash

您甚至可以附加 <embed>它的版本。

在此处查看如何构建多浏览器兼容的 Flash 对象: http://www.alistapart.com/articles/flashsatay

或者,更简单的是,您可以使用 SWFObject: http://code.google.com/p/swfobject/

关于javascript - Flash 对象未正确嵌入 IE 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5583676/

相关文章:

javascript - 将 <div> 锚定到浏览器窗口的顶部

javascript - getElementsByClassName 产生错误 "undefined"

javascript - 从选择框中使用 JS 更改 href 值

jQuery — if 语句中的 hasClass 表现不佳

html - 为什么分词对表格有效但对自动换行无效?

html - img 和文本(带省略号)在同一行 - 居中

JavaScript array.slice() 行为

javascript - 在 slider 插件上实现 RTL

javascript - RegEx 表达式或 jQuery 选择器不匹配 href 中的 "external"链接

jquery - Bootstrap 导航右对齐将共享按钮保持在同一行