Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 348
Vinay Pandey Avatar asked Dec 31 '22 02:12

Vinay Pandey


1 Answers

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.

like image 141
Ariel Avatar answered Jan 12 '23 01:01

Ariel