I have the below code to print the text that is loaded in fancybox. It works perfect in chrome and firefox. But in ie9 it opens a blank window and closes. Then nothing happends.
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;
});
});
Change the following:
print_page.document.write(html);
print_page.print();
into:
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模式下并检查它是否有帮助。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.