I am creating a script which generates popups. But most of the browsers blocks popups by default. I want to open popup on my domain without blocking popups.
var pop = window.open('about:blank', 'new_window_123', 'height=150,width=150');
// Detect pop blocker
setTimeout(function() {
if(!pop || pop.closed || pop.closed == 'undefined' || pop == 'undefined' || parseInt(pop.innerWidth) == 0 || pop.document.documentElement.clientWidth != 150 || pop.document.documentElement.clientHeight != 150){
pop && pop.close();
alert('Popups must be enabled.');
}else{
alert('Popups is enabled.');
pop && pop.close();
}}, 1000);
This script tell me popup enable/disable. Is there a way to turn off popup blocker on browser and run popup
I am creating a script which generates popups. But most of the browsers blocks popups by default. I want to open popup on my domain without blocking popups.
var pop = window.open('about:blank', 'new_window_123', 'height=150,width=150');
// Detect pop blocker
setTimeout(function() {
if(!pop || pop.closed || pop.closed == 'undefined' || pop == 'undefined' || parseInt(pop.innerWidth) == 0 || pop.document.documentElement.clientWidth != 150 || pop.document.documentElement.clientHeight != 150){
pop && pop.close();
alert('Popups must be enabled.');
}else{
alert('Popups is enabled.');
pop && pop.close();
}}, 1000);
This script tell me popup enable/disable. Is there a way to turn off popup blocker on browser and run popup
Share Improve this question asked Oct 14, 2013 at 6:11 BurhanBurhan 2634 silver badges9 bronze badges 3- You can tell the user to enable popups if this is something that's integral to your website, but the answer to your question is no. – Vinay Commented Oct 14, 2013 at 6:13
- Most sites just show a message like "It appears you're using a pop-up blocker, please disable the blocker for this site to work properly" or something along those lines. – Dan Goodspeed Commented Oct 14, 2013 at 6:14
- In my experience, most browsers only block popups if a website sends up a popup more than ~4 times on one page. Users can re-enable if they noticed that they need it. – bean5 Commented Oct 14, 2013 at 6:16
1 Answer
Reset to default 6There is no way to turn off the popup blocker via javascript. If there was, then all scripts that do popups would just do that and the popup blocker would be of no use. In most browsers, there is a way for the end-user to allow popup blockers for the current site, but it is something you would have to instruct the end-user to do, not something your page can do itself.
Some popup blockers will allow a popup window if it is opened in direct response to a user click (e.g. the popup window is opened from within a click handler).
An easier way around the problem (for some kinds of content) is to stop using popup windows and instead use an overlay div that floats above your content in the same window as that is not blocked by the popup blocker.