From 4f17c8d1efb46b7a4f17340cfca0a09dd5f215a2 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 18 Jul 2013 18:37:57 +0530 Subject: [PATCH] [minor] [print] create print html in a new window, so as to avoid style creep --- public/js/legacy/widgets/form/print_format.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/public/js/legacy/widgets/form/print_format.js b/public/js/legacy/widgets/form/print_format.js index 1bf044adf2..bffc23a967 100644 --- a/public/js/legacy/widgets/form/print_format.js +++ b/public/js/legacy/widgets/form/print_format.js @@ -45,16 +45,23 @@ _p.def_print_style_other = "\n.simpletable, .noborder { \ }"; _p.go = function(html) { - var d = document.createElement('div') - d.innerHTML = html - $(d).printElement(); + var w = window.open(); + if(!w) { + msgprint(_("Please enable pop-ups")); + return; + } + w.document.write(html); + w.print(); + w.close(); } _p.preview = function(html) { - var w = window.open(''); - if(!w) return; - w.document.write(html) - w.document.close(); + var w = window.open(); + if(!w) { + msgprint(_("Please enable pop-ups")); + return; + } + w.document.write(html); }