我有一个ASP.Net MVC网站,它使用CEEBOX在弹出窗口中显示youtube视频。
当视频窗口弹出时,我在IE9中得到以下异常:
线路:1错误:无法获取属性"SetReturnValue"的值:对象为null或未定义
如果我尝试使用调试器,我可以看到异常发生在如下所示的部分{格式化是我的}:
try {
document.getElementById("")
.SetReturnValue(__flash__toXML(document.location.href.toString()));
}
catch (e) {
document.getElementById("").SetReturnValue("<undefined/>");
}
触发弹出的锚点的标记为:
<a class="thickbox" rel="width:640 height:385"
href="http://www.youtube.com/watch?v=xxxxxxxxx" >
<span style="background-color: White; position: relative; outline-style: none; ">
<span class="cliplarge" >
<img src="http://zzz.zzz.com/xxxx.jpg"
style="height: 275px; width: 418px; margin-bottom: 0px; margin-top: -35px; "
alt="Test" title="" />
</span>
<div style="z-index:40;position:relative;height:100px;width:100px;top:-140px;left:140px;">
<img src="<%: Url.Content("~/Content/VideoPlay.png") %>" />
</div>
</span>
</a>
问题原来与URL的形式有关:
URL格式为:http://www.youtube.com/watch?v=xxxxxx旨在直接在youtube网站上显示。
而表单中的URL:http://www.youtube.com/v/xxxxxx导致使用全屏播放器,该播放器将在任何帧中显示…如果你将其放在浏览器URL中,它将占据浏览器窗口的全屏。
第二种形式似乎更适合弹出窗口,并且没有出现异常。