Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sreeni san
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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
 
Sonal Jogi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic