View Full Version : Please help - cant open new window !!!

10-21-2006, 09:20 PM
On my site, I link from a listing to a new window.

The site works fine in Moz FF but in IE it is ... half working.

If you look at my front page you will see a
three advert listing. Clicking on the links in IE
works fine - a new window is opened. And when you close the window you go back to the main window again.

BUT if you go to one of the main listings eg "Local Services"
and then click on an advert there - a new window is NOT opened :mad:

Can anyone see why this is ?
If source code isn't enough I can post the relevent code chunks here
( please ask :D )

My site: www.yodbod.com

Thanks for your help cos this is driving me mad !!!

10-22-2006, 06:35 PM
Good chance IE is not liking the / in the name

var w = window.open (this.href, 'homes/accommodation/house-share-rooms/rentals/N/NN/ad-1.html', 'height=800,width=960,scrollbars');
Why is your name (2nd parameter the url)? Just give it a simple one word name.

10-22-2006, 08:45 PM
Thank you :thumbsup:

I didn't know that was just a name param :o
I thought it had to be th url.

So it all works now !!! :) :D :D :D

10-22-2006, 08:55 PM
Presently when I click on another link it opens in the same secondary window, replacing the original advert.

How can I have it open a new different window for each advert link.

If you notice - I do have a "close this window" button

I would like to give poeple the ability to open many adverts.

What would I need to change in the code ?

<a href='$Ad_detail' rel=\"external\" onclick=\"var w = window.open (this.href, 'advert', 'height=800,width=960,scrollbars'); w.focus(); return false\" >

This js is loaded when the main window opens:

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
window.onload = externalLinks;

I know this is a long-winded way of saying target = "_blank"
but apparently target = "_blank" is now depreciated
but you can use it js !!
( just trying to keep to w3w stds lol )

Please check out the site at www.yodbod.com

thanks :)

10-22-2006, 09:34 PM
Assign the windows different names to get separate windows. If you don't want to do it manually, use a JavaScript loop to assign different names (numbers) to each link or script it so that the current time becomes the name.