DaveDev
DaveDev

Reputation: 42225

Can I Open a New Browser Window Minimised with Print Dialog Already Open?

I understand I can call window.print() when the page loads to load the print dialog, but can I force the window to be minimised from the point that it's opened and the print dialog is generated? Ideally it would be minimised until the user maximises it. Thanks

Upvotes: 0

Views: 481

Answers (2)

salgiza
salgiza

Reputation: 5900

Short answer: No.

Abbreviated answer: you'll have every antispam tool against you if you try to open windows and play with then in javascript.

But... you could use the help of @media print {} in css. Add a div with the content you want to print to the page (and load it via Ajax, or using an iframe). By using "@media print" rules in the CSS you can tell the browser to hide the page that the user is seeing in the browser (by including it in a big div and adding a display:none to the print rule) and show the hidden div. The nice thing of this solution is that you can play with both divs via javascript, for example you could add buttons to show/hide the print div, etc.

Upvotes: 1

Run CMD
Run CMD

Reputation: 3035

you could try to open a new window outside the screen bounds so it's not visible. (x=-10000, y=-2000). Then, when it's loaded, print it and close it.

Upvotes: 0

Related Questions