[英]Javascript error in Internet Explorer
I have a problem with a js script running in Internet Explorer. 我在Internet Explorer中运行的js脚本有问题。
Basically the script runs fine in Firefox, but I need to embed it into the webbrowser control in a silverlight application, for which it has to run error free in the Internet Explorer engine. 基本上,该脚本可以在Firefox中正常运行,但是我需要将其嵌入到Silverlight应用程序的webbrowser控件中,为此,它必须在Internet Explorer引擎中运行无错误。
Running it in the IE produces an "Expected object" error in the following line: 在IE中运行它会在以下行中产生“预期对象”错误:
$f("player", "player.swf", {
$ f(“ player”,“ player.swf”,{
How could this be rewritten to also work in IE? 如何将其重写为也可以在IE中使用?
Here is the complete script: 这是完整的脚本:
$f("player", "player.swf", { key: '#@18a1aaa6552d45a2cfe', log: { level: 'debug', filter: 'org.flowplayer.cluster.*' }, clip: { url: 'live3', live: true, provider: 'rtmp', autoBuffer:true, bufferLength:10, scale:'fit', connectionProvider: 'cluster', onStart: function(clip){ } }, canvas: {backgroundImage: 'url(staytuned.jpg)'}, onError:function(err){canvas: {backgroundImage: 'url(taytuned.jpg)'}}, contextMenu: [ 'player 1.1', {'About ...' : function() { location.href = "url/?page=aboutus";}}, {'Contact ...' : function() { location.href = "url/?page=contactus";}}, {'More Casts ...' : function() { location.href = "url/?page=casts";}}, ], plugins: {
overlay: {
url: 'overlay.swf',
top: 0,
right: 0,
width: 854,
height:450,
zIndex:3
},
rtmp: {
url: 'rtmp.swf'
},
cluster: {
url: 'cluster.swf',
netConnectionUrl: 'url',
hosts: [
{host:'url'},
{host:'url'}
]
},
controls: {
autoHide: false,
url:'url',
zIndex:5
},
gatracker: {
url: "analytics.swf",
trackingMode: "Bridge",
bridgeObject: "pageTracker"
}
}
}); });
Thanks, Andrej 谢谢,安德烈
First answer was incorrect. 第一个答案不正确。 See comments for details.
有关详细信息,请参见评论。
Edit 编辑
The problem is likely that $f is not defined at the time you're trying to call it. 问题可能是您尝试调用$ f时未定义它。 Place
alert(typeof $f);
放置
alert(typeof $f);
on the line immediately before the line causing the error. 在导致错误的行之前的行上。 If it doesn't alert
function
, them I'm right. 如果它没有警报
function
,那么我是对的。
Make sure you're including the script that contains the definition for $f before you try to call it. 在尝试调用$ f之前,请确保其中包含了包含$ f定义的脚本。
Goto www.jslint.com. 转到www.jslint.com。 Paste this entire script into the top window and click the "jslint" button below it.
将整个脚本粘贴到顶部窗口中,然后单击其下方的“ jslint”按钮。
You'll find that onError is malformed: 您会发现onError格式错误:
onError:function(err){canvas: {backgroundImage: 'url(taytuned.jpg)'}},
it should read more like: 它应显示为:
onError:function(err) {
var canvas = {backgroundImage: 'url(taytuned.jpg)'};
return canvas;
},
There's a similar issue a few lines below. 下面几行有一个类似的问题。
And I suspect that "taytuned.jpg" needs to be enclosed within quotes, but it's not my script. 而且我怀疑“ taytuned.jpg”需要用引号引起来,但这不是我的脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.