Skip to content

Instantly share code, notes, and snippets.

@slavikdev
Created July 30, 2013 22:26
Show Gist options
  • Save slavikdev/6117629 to your computer and use it in GitHub Desktop.
Save slavikdev/6117629 to your computer and use it in GitHub Desktop.
JavaScript example how to print HTML document in a separate window (specifically tested in Internet Explorer 10).
var print_window = window.open( '', 'Title', 'height=400,width=600' );
print_window.document.write( '<html><body><h1>Hello!</h1></body></html>' );
// NOTE: two statements below make it all work in IE 10.
print_window.document.close();
print_window.focus();
print_window.print();
print_window.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment