Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Popup detection before user logs in

Is there a good way to determine if a person has a popup blocker enabled? I need to maintain a web application that unfortunately has tons of popups throughout it and I need to check if the user has popup blockers enabled.

The only way I've found to do this is to open a window from javascript, check to see if it's open to determine if a blocker is enabled and then close it right away.

This is slightly annoying since users who do not have it enabled see a small flash on the screen as the window opens and closes right away.

Are there any other non-obtrusive methods for accomplishing this?

like image 711
Chris Conway Avatar asked Oct 30 '08 13:10

Chris Conway


1 Answers

Read Detect a popup blocker using Javascript:

Basically you check if the 'window.open' method returns a handle to a newly-opened window.

Looks like this:

var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
if(mine)
    var popUpsBlocked = false
else
    var popUpsBlocked = true
mine.close()
like image 189
Andre Bossard Avatar answered Oct 23 '22 18:10

Andre Bossard