Forum Moderators: open

Message Too Old, No Replies

NS6 and window.blur

         

toolman

9:20 pm on Dec 22, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't seem to get a pop under to pop under in NS 6. It just wants to stay on top. Any fixes?

jsbwm

12:04 am on Dec 23, 2001 (gmt 0)



I dunno bout this but if you are trying to use an onLoad in the body tag you might try using <body onFocus="self.blur()">
Sorry I can't test it right now but that's my guess.
-jim

tedster

12:08 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure that would give the right effect -- you could NEVER give the pop-under focus, so it would only get seen when every other window was aready closed. Not the best time to put a message in front of someone.

Have you checked this in NN 6.2? It may be a bug in 6.0 and 6.1 they've corrected. At any rate, your only having trouble with under .5% of visitors.

oilman

12:14 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just tried in NN 6.2 - still no go. Bizarre that they would ditch something that basic.

jsbwm

12:16 am on Dec 23, 2001 (gmt 0)



Yeah that's true. Well if all else fails can't you just have the popup focus the parent window?

IanKelley

12:20 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's strange... Just discovered that self/window.focus() doesn't work in Netscape 6 either. That means it's not a bug... they intentionally don't support it.

What is it with these guys? :-)

It'll never happen, of course, but wouldn't it be great if developers got together and stopped designing for Netscape? If only 15-20% of sites returned: "We're sorry.., Netscape hates developers and, therefore, this site will not display for Netscape users." maybe then they'd pull their head out their ass :-)

tedster

1:04 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, I did some browsing with Netscape 6, trolling for pop-unders that worked. The way that some sites do it is to name the pop-under window and then blur it from js code in the LAUNCHING window, not in the pop-under itself.

So the opening window runs some javascript code that launches and names the pop-under window "popwin" and then says popwin.blur() followed by self.focus() -- this works.

tedster

1:08 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh no. A few months ago I vowed not to post information about creating poop-unders. Well, it's not the first time I changed my mind.

toolman

1:16 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This what I hacked together from 2 different peices of code...I'm not a js coder at all. What I really want to do is open a winder (including NN6) once per session and center the pop up in the screen automatically...if any js experts could help. Pretty please?

<script type="text/javascript"language="Javascript">
var popunder=new Array()
popunder[0]="inbetween.html"

// Specify the width and height of new popunder window (in pixels).
var width = '600';
var height = '550';

var p = 'scrollbars=yes,resizable=no,toolbar=no,' + //these are obvious variables. set "yes" or "no".
'menubar=no,status=no,location=no,left=0,top=0,height=' + //yes/no, & the screen location
height + ',width=' + width;

// Load new PopUnder only once per browser session? (0=no, 1=yes)
// Putting 0 will cause the Popunder to load every time page is loaded
// Specifying 1 will cause it to load only once per session
var one_time=1

// That's it! Don't edit the code below unless you're really good. :-P //

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if the cookie exists
offset += search.length
end = document.cookie.indexOf(";", offset); // set the index of beginning value

if (end == -1) // set the index of the end of cookie value
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
if ((navigator.userAgent.indexOf("AOL")!=-1)){
document.cookie="popunder=yes"
}
function loadornot(){
if (get_cookie('popunder')==''){
andBoom()
document.cookie="popunder=yes"
}
}
function loadornot(){
if (get_cookie('popunder')==''){
load_pop_power()
document.cookie="popunder=yes"
}
}

function load_pop_power(){
win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p)
win2.blur()
self.window.focus()
}

if (one_time==0)
load_pop_power()
else
loadornot()
</script>

tedster

4:24 am on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looking at this section of code:
--

function load_pop_power(){
win2=window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p)
win2.blur()
self.window.focus()
}

--
The window.open() method in this code declares the new window name as "bw". Setting the win2 variable equal to the window.open() method doesn't make sense to me. I think you just want the function to call the method, blur the pop-up and then focus the current window.

I might be missing something, but I'd suggest this:
--

function load_pop_power(){
window.open(popunder[Math.floor(Math.random()*(popunder.length))],"bw",p);
bw.blur();
self.focus();
}

toolman

4:58 pm on Dec 23, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That makes the pop under pop on top in IE tedster. I wonder if maybe it would be better to just put NN6 up there with the AOL sniffer and forget it.

IanKelley

8:41 am on Dec 24, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just add: self.blur() to the popup... since this will be executed after the code in the main window this should fix the IE problem.