我有一个网页包含一个链接 - 点击链接可以打开一个新窗口显示YouTube视频。在Chrome中可以正常工作,但在IE中无法运行。IE控制台显示:SCRIPT5009:'open_win'未定义(我正在使用IE11)。
在标签中我有:
function open_win(url)
{
new_window = open('','video','width=500,height=390,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');
// open new document
new_window.document.open();
// Text of the new document
new_window.document.write("<html><head></head><body style='background-color:'black';margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;'>");
new_window.document.write("<iframe width='560' height='315' src='https://www.youtube.com/embed/-linkRedacted-' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>");
new_window.document.write("</body></html>");
// close the document
new_window.document.close();
}
我现在有以下内容:
<a class="audio" href="javascript:void(0)" onclick="open_win()">
<img alt="See a demo video (opens in New window)" src="images/demo.jpg" width="120" height="110" /></a>
这是一个IE安全区域问题,还是编码错误?
<script>...</script>
标签内? - Barmar