• You thought the first one was fun?
    Temple Run
    2
    CLICK HERE!
  • With just a swipe of your finger
    Find a
    date
    CLICK HERE!
  • The Everest App
    is shutting down
    soon!
    CLICK HERE!

Detect popup blocker

 

How to check if the browser viewing this page is blocking popup windows

 

If you have a popup blocker enabled on your web browser, you will have just seen a Javascript alerting you to this.

 

This can be very useful on your own website, I use a popup window to view my shopping cart, but if a popup blocker is enabled on a users browser, then my potential customers have a very difficult time ordering on my website.


So, I either use the script above to read:

'You are using popup blocker software. This website needs to open a window to show you the shopping cart... please disable your popup blocker.'


Or, I check if they are using a popup blocker
, and then show them a direct link to click on which opens a window. This is more useful, as most popup blockers only block non-user activated poups, i.e. popups that happen without the user clicking a link. Also, it makes for a smoother experience as users don't have to turn their poup blocker on and off again just for your site (you will probably lose them, I wouldn't bother doing this for most websites).

'You are using popup blocker software. Please click here to your the shopping cart"

(the link is just a dummy, but you get the idea)

 

The Popup Code

 

You will need to copy and paste 2 bits of code.

Copy and paste this into your page before the </head> tag: 

Now, copy and paste this anywhere in the rest of your page: 

Done!

You can download this test page, test popup blocker.htm to see the script works on your website
(you will need to uncompress it from a ZIP file first)

 

Advanced use of the popup blocker detector

 

Here's a bit of code to give your users different options depending on whether or not they have a popup blocker enabled.

Now, copy and paste this anywhere in the rest of your page:

I hope you enjoyed this article / tutorial, I have many more on a wide range of website and internet topics.

Yari McGauley
Creator of Visitor Stats 2 - Topnotch website visitor tracking

 




Latest News

Tinder also goes on to claim that they are not the only product that offers different pricing for different age groups, and while that is most certainly true the example they cite is Spotify and their student pricing. They also claim that they are trying to make their product available to younger people cheaper as they are more budget constrained.
Read More