Commit 60245e4a authored by jcnventura's avatar jcnventura

Issue #1579870: wait for document to be fully loaded before asking the browser to print the page.

parent ebf26647
......@@ -168,7 +168,7 @@ function print_preprocess_print(&$variables) {
drupal_add_js('misc/drupal.js', array('weight' => JS_LIBRARY));
$window_close = (variable_get('print_html_new_window', PRINT_HTML_NEW_WINDOW_DEFAULT) && variable_get('print_html_windowclose', PRINT_HTML_WINDOWCLOSE_DEFAULT)) ? 'window.close();' : '';
$variables['sendtoprinter'] = "<script type='text/javascript'>(function ($) { Drupal.behaviors.print = { attach: function(context) {window.print();$window_close}};}(jQuery));</script>";
$variables['sendtoprinter'] = '<script type="text/javascript">(function ($) { Drupal.behaviors.print = {attach: function(context) {$(window).load(function() {window.print();' . $window_close . '})}}})(jQuery);</script>';
}
$type = (isset($node->type)) ? $node->type : '';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment