PDA

View Full Version : window.open and close immediately



romperstomper
10-01-2007, 10:41 AM
Allright, first I'm going to explain what I want to achieve. I have a couple of websites, and one of them gets massive hits, so I want to "share" these hits with my other sites.

Now I'm using some kind of a pop-under script, wich you can find here (http://www.dynamicdrive.com/forums/showthread.php?t=12336), to promote my other sites, but I want to get a step further. I want the pop-under to open and close immediatly, so that when someone cliks on my site, the other site also gets a hit.

Hope you guys understand what I mean, and hope that someone can help me out on this one.

jscheuer1
10-01-2007, 02:48 PM
If you are using this:


function goNewWin() {

TheNewWin =window.open("http://www.yahoo.com",'TheNewpop','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');

TheNewWin.blur();
TheNewWin.close();

}

But, as I mentioned in that thread, it will not work in IE 7.

However, in that thread you claimed you had no control over the pages in the new window. If they are the pages from your other site, you should. You can have script on those pages to close the window onload. Now, you might wonder, how can this page ever be seen then? As long as the window isn't opened with javascript, it cannot be closed with javascript.

Trinithis
10-01-2007, 02:54 PM
You could try using iframes to load the page and make them invisible.

jscheuer1
10-01-2007, 03:02 PM
You could try using iframes to load the page and make them invisible.

That's a pretty cool idea, instead of opening a new window onclick, which can always be blocked, and has (for the purposes of this exercise) other problems, you could have an iframe on the true destination page, and besides setting its position absolute and its visibility hidden, you could set its onload event to remove itself from the page.