Vinay Pandey
Vinay Pandey

Reputation: 8913

window.open not working when attached on onload event in chrome and safari

I have attached some javascript on onload event of the form. this script contains window.open. Although this works fine in all the browsers window.open doesn't open a new window nor it gives nay error message in google chrome and firefox.

I want to first check the screen resolution if it is less than 1024 then I would open it in a new window without menu,toolbar and others so that the user has more space to work on.

Upvotes: 4

Views: 5046

Answers (2)

eyelidlessness
eyelidlessness

Reputation: 63519

If you have a legitimate reason for opening another window, attach a click event to a button labeled such that it properly indicates you'll be opening a window. If your user wants to open the window, they will do so, and it will correctly get past any but the stupidest popup blockers. If they don't want to, you should not be opening a window in the first place.

Upvotes: 3

Ariel
Ariel

Reputation: 872

This is a feature, not a bug! :)

remember back in the '90s when pop-up windows annoyed the crap out of everyone? Well, because of the MASSIVE abuse of that JavaScript behavior, now the only way to open windows is with direct user interaction; like a click.

Upvotes: 7

Related Questions