• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to by pass pop up blockers while using window,open()

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using a javascript function which opens a new window to launch the given URL.

function launch () {
target="/xyz/xyz"
y=window.open (target, "newwin", "scrollbars=yes, status=yes,menubar=no,resizable=yes");
y.focus;
}

When this function is called, the popup blocker on my browser is not allowing me to launch the new browser window.

Is there a way for me to find that there is an active popupblocker from the launch()java script and bypass the pop up blocker (without manully disabling the pop up blocker)? or may be is ther a way to find out that there is a pop up blocker so that a java script alert message can be shown to the user?

Thanks in advance.

Sreeni.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not bypass a pop up blocker, that would defeat their purpose!

Blogged about it here: http://radio.javaranch.com/pascarello/2005/05/12/1115907581343.html

Pop ups are normally blocked if they are created without a user ineraction. aka onload, onclose, timers.

Eric
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, U can find whether a popup blocker is present using a simply javascript function:
function IsPopupBlocker() {
var oWin = window.open ("","testpopupblocker","width=100,height=50,top=5000,left=5000");
if (oWin==null || typeof(oWin)=="undefined") {
return true;
} else {
oWin.close();
return false;
}
}

And yes you can bypass a popup blocker by making contineous hits. Out of there hits, one would open sure shotly. have tried it out.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you were to do a loop, you have a big chance that you are going to freeze the browser of the user going to the site.
 
Sonal Jogi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No such problem had not occured till now. If 3 concurrent html statements are written for openeing a popup window, 2 get blocked but the trid one gets open.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I see the code and what browser and pop up blocker are you running?

I ran tests earilier and posted it on my blocg here:
http://radio.javaranch.com/pascarello/2005/05/24/1116946280225.html

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic