How to check whether popups are disabled on client browser

Sometimes we use popups in our application. But what if popups are disabled on the client browser? Then it’s possible that your entire application would fail. By using the below code snippet, you can check whether client browser has disabled popups so you can implement an alternative way if popups are disabled.

var myWindow=window.open('http://ruchirac.blogpost.com');
if (myWindow== null || typeof(myWindow)=='undefined') {
  alert('Popups are disabled');

No comments: