I need the code that will generate a pop up window in the top of the web page dispalying the message "Your pop up blocker has been enabled. Please disable it to continue" in case if the pop up blocker has been enabled. Or else it should move on to the next page.
Asked
Active
Viewed 836 times
1
-
watch this if it could help http://www.davidtong.me/detecting-popup-blocker-pattern/ – ZafarYousafi Aug 06 '12 at 05:13
1 Answers
0
You can use the following code
var wPopup = 'newPopup';
var popUp = window.open('page url', wPopup, 'width=800, height=600, left=24, top=24, scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
alert('Your pop up blocker has been enabled. Please disable it to continue');
}
else {
popUp.focus();
}
There is already a question in stackoverflow which will be helpful Detect blocked popup in Chrome
-
I used this code. But its not working. Even if the pop up blocker has been enabled, it is redirecting to the next page. – user1575995 Aug 06 '12 at 05:31
-
Its working for me. Please tell what have you tried. Check if there is any typo. – Narendra Aug 06 '12 at 06:02
-
1st check by disabling popup blocker that it is opening popups, then try with enabling popup blocker to check whether it is blocking or not. – Narendra Aug 06 '12 at 06:03