Browser safe way to open a new window sized to content (not a tab) and bring up the OS's print dialog?
开发者_运维技巧Normally I would use:
window.openDialog();
then in that Window's body element's onload event call
window.print();
But neither seem to be working in Google Chrome?!
What I am trying to do is simply create a print view of a page.
window.openDialog()
is not cross-browser compatible. It's an extension from window.open()
, which all major browsers support, so you should use that instead.
See:
- http://code.google.com/p/doctype/wiki/WindowOpenDialogMethod
- http://code.google.com/p/doctype/wiki/WindowOpenMethod
window.print()
should work though.
精彩评论