Popups are sometimes good. Sometimes we want to show our data on popups or want to give some functionality which creates popups. But it becomes a tedious job when user’s popups are blocked by default by their browsers. In such situations we can alert users to enable their popups by unblocking them for your website.

Here is a small snippet using which we can easily check if popup blocker of client browser is on/off. Here we are using a simple javascript. we will make a user defined function and will open a window using javascript’s function and will try to open any random url ( in below example) and will see whether it returns true or false.

If returned false that means popup blocker of user’s browser is active. So here we will ask user to enable it and if returned true that means browser is allowing to open popups, so as soon as we will open he url ( here) in a popup window we will close it.

Here is complete code:

how to check popup blocker using javascript