GetDotted Domains

Viewing Thread:
"Javascript - window.close()"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Mon 20/10/03 at 01:34
"High polygon count"
Posts: 15,624
I want a popup window on my eBay listings to display my auction terms and conditions when someone clicks on a link.

I was doing this with the simple HTML 'TARGET=_BLANK' functionality, but I really want a window of a set size and without all the usual browser toolbars, resize functionality and everything else - all I want is the vertical scrollbar.

I have acheived this using the 'onclick' method and it works fine... except eBay's bloody system won't accept the page HTML with these in place.

My work-around was to open a default browser window using TARGET="_BLANK" from within the eBay listing; this window would hold a simple page, with Javascript which would in turn open the required window and then close itself down.

I have also acheived this.

It uses the window.open() function to open a new window of a certain size, minus all the toolbars, resizing options and everything else except the vertical scrollbar.

It then uses the window.close() function to close itself.

But!

Internet Explorer keeps popping up an alert with the following message and question:

-----

The web page you are viewing is trying to close the window.

Do you want to close this window?

-----

I realise this is probably due to my security settings, but is there any way to over-ride it?

On pages which tie the window.close() function to a link - for example:

Close window

...I don't get this alert, even though the function is the same.


I'm no Javascript wizard, and all of this functionality has been put in place simply by looking at other people's code. So, can anyone help me overcome this problem?
Wed 22/10/03 at 18:26
"High polygon count"
Posts: 15,624
Bother! Problem encountered... can anyone help?

I solved the popup problem by using...

TERMS & CONDITIONS

...in my item listing on eBay.

The '#Top' anchor can also be '#Shipping', '#Payment' or '#Returns', linking to various places in the TandC.htm page.

That page is a dummy redirect page (you can only use TARGET="_BLANK" on eBay as they block JavaScript popups) and contains the following JavaScript...

-----



-----

This basically takes the anchor name from...

http://paranoimia.co.uk/ebay/popups/TandC.htm#Top (or #Shipping etc.)

...and creates the new URL...

http://paranoimia.co.uk/common/popups/TandC.htm#Top

...which is the *actual* Terms & Conditions document.

It then opens a new window of the specified dimensions and options, containing the *actual* Terms & conditions page, and jumps to the section the user clicked on, and closes the redirect window.

It's all been tested on my machine and works fine. Uploaded it and used it on an eBay listing, and it works fine.

At least on my machine it does. I'm running Windows XP Home edition.

But when I view the auction listing on another machine running Windows ME and click on the links, it just gets stuck in a loop, opening window after window and never actually displaying the Terms & Conditions page.

I can think of no reason why it works on one machine and not on another.

Anyone see any obvious problems or offer advice?

I've changed the listing now so that it doesn't use this script, but I really want to get it working properly.
Wed 22/10/03 at 00:28
"High polygon count"
Posts: 15,624
Woohoo!

With a bit more poking around on the net and playing around with JavaScript, I've managed to get exactly what I wanted...

...a popup window for my auction terms & conditions, sized exactly as I want it, without toolbars and so on... all accessed through a JavaScript which eBay won't allow me to run directly from my auction listings.

It wasn't really difficult at all once I knew what was doing, but I'm still feeling very happy with myself.

Take that, eBay!
Mon 20/10/03 at 19:31
"High polygon count"
Posts: 15,624
It's okay, forget ALL of that... I've been an idiot, and there's nothing wrong with my code at all. It was something else entirely!
Mon 20/10/03 at 19:00
Regular
"Master Chef - halo"
Posts: 426
You could try emailing SR.

They can do it with the pop up window with the stats don't they?
Mon 20/10/03 at 18:38
"High polygon count"
Posts: 15,624
Okay, in my continuing efforts... why doesn't this work?

I have a script called TandC.js on my server, containing the following:

-----

function ShowTandC(idx)
{ switch (idx){
case "top" :
window.open ("http://paranoimia.co.uk/common /popups/TandC.htm#Top", "TandC", 500, 400, 50, 50, menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=no);
break;
case "shipping" :
window.open ("http://paranoimia.co.uk/common /popups/TandC.htm#Shipping", "TandC", 500, 400, 50, 50, menubar=no, status=no,location=no, toolbar=no, scrollbars=yes, resizable=no);
break;
case "payment" :
window.open ("http://paranoimia.co.uk/common /popups/TandC.htm#Payment", "TandC", 500, 400, 50, 50, menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=no);
break;
case "returns" :
window.open ("http://paranoimia.co.uk/common /popups/TandC.htm#Returns", "TandC", 500, 400, 50, 50, menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=no);
break;
default :
window.open ("http://paranoimia.co.uk/common /popups/TandC.htm#Top", "TandC", 500, 400, 50, 50, menubar=no, status=no, location=no, toolbar=no, scrollbars=yes, resizable=no);
}
}

-----

(All extra spaces added due to SR's 60-character limit)


It's called from the HTML with the following link:


TERMS & CONDITIONS



When the page loads, I get an error reported by IE at the bottom. Clicking the icon gives me:

Line: 16
Char: 22
Error: 'document.links[...].innerHTML' is null or not an object


Then if I click on the link anyway, I get:

Line: 14
Char: 7
Error: 'no' is undefined


I've checked that the .js file is uploaded in ASCII mode, and the code itself seems okay from what I've read at http://www.wdvl.com/Authoring/JavaScript/Tutorial/

So... what's wrong?

This is my first ever attempt at Javascript, so be gentle!
Mon 20/10/03 at 01:34
"High polygon count"
Posts: 15,624
I want a popup window on my eBay listings to display my auction terms and conditions when someone clicks on a link.

I was doing this with the simple HTML 'TARGET=_BLANK' functionality, but I really want a window of a set size and without all the usual browser toolbars, resize functionality and everything else - all I want is the vertical scrollbar.

I have acheived this using the 'onclick' method and it works fine... except eBay's bloody system won't accept the page HTML with these in place.

My work-around was to open a default browser window using TARGET="_BLANK" from within the eBay listing; this window would hold a simple page, with Javascript which would in turn open the required window and then close itself down.

I have also acheived this.

It uses the window.open() function to open a new window of a certain size, minus all the toolbars, resizing options and everything else except the vertical scrollbar.

It then uses the window.close() function to close itself.

But!

Internet Explorer keeps popping up an alert with the following message and question:

-----

The web page you are viewing is trying to close the window.

Do you want to close this window?

-----

I realise this is probably due to my security settings, but is there any way to over-ride it?

On pages which tie the window.close() function to a link - for example:

Close window

...I don't get this alert, even though the function is the same.


I'm no Javascript wizard, and all of this functionality has been put in place simply by looking at other people's code. So, can anyone help me overcome this problem?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
LOVE it....
You have made it so easy to build & host a website!!!
Gemma

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.