[英]Js print function not working in ie9
我有以下代碼來打印在fancybox中加載的文本。 它在chrome和firefox中非常完美。 但在ie9中它打開一個空白窗口並關閉。 然后什么也沒發生。
jQuery(function($) {
$('a.print').click(function() {
var print_button = '';
var print_page = window.open('', 'Print', 'width=600,scrollbars=yes, height=700');
var html = '<h2><?php print t("Term & Condition"); ?></h2> <br/>' + '<?php echo $body_content; ?>';
print_page.document.open();
print_page.document.write(html);
print_page.print();
print_page.close();
return false;
});
});
更改以下內容:
print_page.document.write(html);
print_page.print();
成:
print_page.document.write(html);
print_page.document.close();
print_page.focus();
print_page.print();
JSFiddle 。
嘗試在頭部添加<meta http-equiv="X-UA-Compatible" content="IE8"/>
,以便頁面呈現在IE8模式下並檢查它是否有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.