【发布时间】:2010-05-31 13:53:24
【问题描述】:
在创建弹出窗口onclick 后,我遇到了一个奇怪的问题。弹出窗口打开,但在 IE8 上立即挂起(在包括 IE6 在内的所有其他浏览器上都可以正常工作)。但是在 JavaScript 代码中添加 alertbox 时,弹出窗口工作正常。
我使用的是
**https**而不是**http**,我觉得popup 无法加载JS 文件,因为SSL。
这是我生成onclick 事件的方式:
<a id="forgotPasswordLink" href="#" onclick="openSupportPage();"> Some Text </a>
onclick 函数是这样定义的:
function openSupportPage() {
var features = "width=700,height=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes";
var winId = window.open('', '', features);
winId.focus();
winId.document.open();
winId.document.write('<html><head><title>' + document.title + '</title><link rel="stylesheet" href="./css/default.css" type="text/css">\n');
var is_ie6 = (
window.external && typeof window.XMLHttpRequest == "undefined");
alert(is_ie6);/*The JS include below*/
/*works in popup only with this alert box.*/
/*else IE8 Hangs*/
winId.document.write('<script src="../js/tiny_mce/tiny_mce.js" type="text/javascript">Script_IE8</script>\n');
winId.document.write('<script type="text/javascript">\n');
winId.document.write('function inittextarea() {\n');
winId.document.write('tinyMCE.init({ \n');
winId.document.write('elements : "content",\n');
winId.document.write('theme : "advanced",\n');
winId.document.write('readonly : true,\n');
winId.document.write('mode : "exact",\n');
winId.document.write('theme : "advanced",\n');
winId.document.write('readonly : true,\n');
winId.document.write('setup : function(ed) {\n');
winId.document.write('ed.onInit.add(function() {\n');
winId.document.write('tinyMCE.activeEditor.execCommand("mceToggleVisualAid");\n');
winId.document.write('});\n');
winId.document.write('}\n');
winId.document.write('});}</script>\n');
winId.document.write('</head><body onload="inittextarea()">\n');
winId.document.write(' \n');
var hiddenFrameHTML = document.getElementById("HiddenFrame").innerHTML;
hiddenFrameHTML = hiddenFrameHTML.replace(/&/gi, "&");
hiddenFrameHTML = hiddenFrameHTML.replace(/</gi, "<");
hiddenFrameHTML = hiddenFrameHTML.replace(/>/gi, ">");
winId.document.write(hiddenFrameHTML);
winId.document.write('<textarea id="content" rows="10" style="width:100%">\n');
winId.document.write(document.getElementById(top.document.forms[0].id + ":supportStuff").innerHTML);
winId.document.write('</textArea>\n');
var hiddenFrameHTML2 = document.getElementById("HiddenFrame2").innerHTML;
hiddenFrameHTML2 = hiddenFrameHTML2.replace(/&/gi, "&");
hiddenFrameHTML2 = hiddenFrameHTML2.replace(/</gi, "<");
hiddenFrameHTML2 = hiddenFrameHTML2.replace(/>/gi, ">");
winId.document.write(hiddenFrameHTML2);
winId.document.write('</body></html>\n');
winId.document.close();
}
请帮我解决这个问题。如果需要,我可以提供更多信息。
我参考了这些帖子 已经:
- Importing js file in https page using http URL in IE8
- Force Browser Mode=IE8 and document mode=IE8 Standards
其他信息:
【问题讨论】:
-
为什么 JavaScript 在两个不同的地方?
./当前目录和../父目录 -
IE 何时以一种不奇怪的方式崩溃?当然,看到它按预期工作可能会很奇怪......
-
@Nalum 我正在为这些浏览器使用不同的 JS 文件。但我可以合并它们。但我可以合并它们我尝试使用单个 JS 文件,但没有帮助
-
@Joseph 问题是它在 IE6 中工作!
-
HiddenFrame和HiddenFrame2包含什么?您是否有示例页面,以便我们可以单步执行您的代码?
标签: javascript https popup tinymce internet-explorer-8