Forum Moderators: open

Message Too Old, No Replies

Loading in parent and closing pop-up

I've found tips on here but am having problems impletmenting them

         

Beau

10:24 am on Aug 18, 2004 (gmt 0)

10+ Year Member



First off - as a newbie I'd just like to say what a great resource this is. I've found solutions to loads of issues using search - including this one! I'm just having problems implementing it.

Clicking on a product brings the product details up in a pop-up (or main window if java is disabled). As it is not an online shop the client wants a link to their contacts page in the pop-up.

I can get the contacts page to load in the parent fine but can't get the pop-up to automatically close.

I found the script for it here from txbakers [webmasterworld.com...]

So in the pop-up header I've put:
<script>
function main() {
opener.location.href="../contact.htm";
window.close();
}
</script>

and in the body:
<a href="../contact.htm" onClick="main()">contact us</a>

This appears to be what txbakers has listed in the above link so where am I going wrong?

TIA
Beau

Beau

3:00 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



Sorted now using different code suggested elsewhere:

onClick="javascript:window.opener.location.href='../contact.htm';window.close()"

Bernard Marx

3:19 pm on Aug 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Drop the "javascript:" part - not necessary.

Beau

5:01 pm on Aug 18, 2004 (gmt 0)

10+ Year Member



Interesting Bernard.

Will leaving it in / taking it out affect how the link works when a user who has javascript disabled accesses the page?

The previous page that loads the pop up is coded so that if a user has javascript disabled the popup page will load in the parent. Obviously what I don't want to happen in that case is to cause a conflict when that user then clicks on the link (as there is no window needing to be closed).