我想用自定義html內容打開彈出式窗口IE瀏覽器。使用提供Can I open a new window and populate it with a string variable?頁用IE瀏覽器自定義html內容打開新窗口
我用下面的JavaScript的答案片段:
var wnd = window.open("about:blank", "", "");
wnd.document.write(htmlContent);
wnd.document.close();
這段代碼打開一個新標籤,而不是一個彈出窗口的內容,所以我用了額外的參數_blank作爲如下:
var wnd = window.open("about:blank", "", "_blank");
wnd.document.write(htmlContent);
wnd.document.close();
現在,一個彈出我的內容打開,但它沒有滾動條,不調整大小,沒有菜單,由於其印刷是不可能的。我已經嘗試過的一種方法是使用windowfeatures參數,如下所示:
var strWindowFeatures =
"menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
var wnd = window.open("about:blank", strWindowFeatures, "_blank");
wnd.document.write(htmlContent);
wnd.document.close();
但是使用此參數對結果彈出窗口沒有影響。另外,在Chrome中,彈出窗口沒有內容。我怎麼解決這個問題?