Webmaster Forum Rules | Posting Guide | Contact Us | Testimonials | Contributing Geek Program | Advertise on Geek/Talk
Welcome to the GeekTalk Webmaster Discussion Forums from GeekVillage.com

Click Here To Register. It's Free!

Go Back   geek/talk: Web publishing business discussion > YOUR REVENUE: Making Money On The Internet > Making Money with CPC and/or CPM Programs
User Name
Password
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 05-24-2001, 04:13 AM   #1
demae
Registered User
 
Join Date: Nov 2000
Posts: 1,291
Unhappy window.focus() in popunder programs

I have a general complaint about the way popunder programs implement their code:

popup = window.open('http://popup-url'); // this opens the popup window
window.focus(); // this brings the window that opened the popup to the foreground (to cover the popup)

The problem is, if the window calling the popup is NOT in the foreground when this code is called, it will go into the foreground too.

I think that a better solution is:

Code:
<body onmouseover="status='focused'" onblur="status='blurred'">
<script language="JavaScript" type="text/javascript">
<!--
var status = 'blurred';
popup = window.open('http://popup-url');
if (status == 'focused') // if the window was in the foreground
  window.focus(); // then put it back in the foreground
else
  popup.blur(); // put the popunder window in the background
// -->
</script>
The "status" variable (which indicates whether the window is in the foreground or not) starts out as 'blurred'; the onmouseover property of the BODY tag will set it to 'focused', which would happen if the window is in the foreground. (I use onmouseover instead of onfocus because the initial status of the window could be either focused or blurred; if I only used onfocus and onblur I wouldn't know which one it is.)

What do you think -- did I make any mistakes in the code (I tested it but maybe I missed something), and is there a better way of doing this (perhaps some variable I can simply read that tells whether the window has focus)?

[This message has been edited by demae (edited 05-24-2001).]
demae is offline   Reply With Quote
Old 05-24-2001, 08:17 PM   #2
demae
Registered User
 
Join Date: Nov 2000
Posts: 1,291
Unhappy

scnofx: With the onfocus event, do you mean something like this:

onfocus="status='focused'"
onblur="status='blurred'"

I thought about that, but the problem is how do I initialize the status variable? The window could initially be focused or blurred, and I don't know which.

I'm finding that this does not seem to be a trivial problem to solve, though. Netscape does not capture events for mouseover on the window, but IE does...

A page can load when it's not in the active window if someone starts loading the page, and then ALT+TABs to another window before it's finished loading (people who browse with multiple browser windows open simultaneously can do this). The Opera browser also has an option to open a link in a new window in the background.

It's becoming apparent that the ad networks didn't take this into account because (1) it's not a trivial problem to solve, and (2) it only affects power users who browse with multiple windows.
demae is offline   Reply With Quote
Old 05-24-2001, 11:44 PM   #3
scnofx
Member.
 
Join Date: Mar 2001
Posts: 253
Unhappy

The mouseover event can happen even if the window isn't on the foreground, you should use the onfocus event instead.

Also I don't see how this can be a problem because the popunder appears when the page loads and I can't see how a page could load while it isn't an active window.

------------------
Customizable blind link & popup program! Sign up now:
ClickHere2Surf.com

webmaster@clickhere2surf.com
scnofx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What would make you fall in love with CPA programs? Larwee Making Money with CPA Programs 3 03-07-2006 08:13 PM
Are affiliate programs worth it? tmax Making Money with CPC and/or CPM Programs 8 06-15-2001 11:48 PM
CJ eliminating all CPC programs on August 1 (confirmed) Kaycee Making Money with CPC and/or CPM Programs 16 06-03-2001 11:34 PM
My best'n'worst programs, October summarized... WildComputer Making Money with CPC and/or CPM Programs 4 11-09-1999 08:16 PM

Please support our advertisers. They ensure our survival.

All times are GMT -5. The time now is 07:10 PM.


GeekVillage.com is copyright © 1998-2015 Curiosity Cave - Science gifts for clever kids. All rights reserved.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.