This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Disable popup blocker using JavaScript?

 
Sirish Kumar Gongal Reddy
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I need to check for the popup blocker status if popup blocker is enabled I need to disable that until I am using my application. how can i do this using javascript?

I need to do this with javascript only. Is't possible to put popup blocker in the enable mode before existing my application..?

Thanks in advance!

Regards,
Sirish
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay if you were able to disable a pop up blocker with JavaScript, than what would be the purpose of having it in the first place?

It is there to stop them and you can not turn it off. Best you can do is:

winpop = window.open("asdf.html");
if(!winpop || winpop.closed)alert("foobar");

Eric
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess another question might be why you need it disabled. Maybe there is a better approach to your problem that you are missing. If you describe what you are doing maybe we can help come up with something good where the popup blocker is not an issue.
 
Sirish Kumar Gongal Reddy
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg/Eric,

First and foremost thanks for your quick reply!

Why I insist to disable popup blocker is my application is having lot's of popup window every time my application tries to open a pop up window popup blocker is blocking that. So What i thought is, it is better to disable pop up blocker as long as I am in my application.

What do you guys think, is it feasible solution or is there any other best approch. Please narrate few lines about this problme.

Many thanks,
Sirish
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing you can do as a coding standpoint to get around the pop up blocker. Best thing you can do is test to see if the window is open after you do it. I put the code in my previous post. If this is a corporate application, get your compamy to include your website in the safe list when they do the builds.

Personally I will never use a pop up window again because of iframes and Ajax.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic