Link to home
Start Free TrialLog in
Avatar of dklauk
dklauk

asked on

popup: close it then redirect to web page

In an asp page I use an "onlick" to "window.open" a popup.  From within the popup I want to let the user go to a specific page of the current website and to close the popup.

I have tried several approaches but can't seem to make the close and redirect  work.

Here's the code in the popup .asp...
=== === === ===
<script>
<!--
function RedirectToContactPage()
{
window.location.href = 'http://trulyscrumptioussc.com/contact.asp'
window.close('cateringdetails.asp')
}
// -->
</script>
</head>
<html>
<body>                                                                                                                                                  
 <table height="10" border="0"><tr align="left"><td width="500"><SPAN class="smalltitle">For more information <A href="#" onclick="Javascript:RedirectToContactPage();">contact us</A> online or call us at 803.957.2092.</SPAN>
</td><td align="right" height="10"><img src="picts/spacer.gif" width="100" height="10" border="0"><a href="#" onclick="window.close()">Close Window</a></td></tr></table>
 === === === ===
Thanks for any help.
Avatar of ethan_mmg
ethan_mmg

In your function RedirectToContactPage(), you need to use opener.location = 'http://trulyscrumptioussc.com/contact.asp' to affect the original window instead of the popup.

Ethan
Avatar of dklauk

ASKER

opener.location line of code did not work.  MAybe I didn't state the problem accurately enough.

From inside the popup asp I want the user to click a link that will giv ehim/her a specific page of the current website at the same time closing the original popup asp.

I tried the opener code in different scenarios and still could not ge tit to work.

Avatar of dklauk

ASKER

This might state it more accurately...

A webpage (asp) of the parent window (the current website) does an <A href> to a popup using window.open.  This popup then needs to open a different web page of the parent window via a link, but also needs to close the popup window.

Hope this helps.

 
ASKER CERTIFIED SOLUTION
Avatar of ethan_mmg
ethan_mmg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dklauk

ASKER

Thanks.  What is happening is that the popup indeed closes but the opener.location(trulyscrumptioussc.com/contact.asp') page is not being shown.  However, the start page( in this case, index.asp) is shown.  So, it looks like I don't really want to use opener.location as it puts me back to the index.asp of the current website and a specific page of the website.

Is there another javascript line that will put me to another page of the current website?


opener.location=('http://trulyscrumptioussc.com/contact.asp');
window.close();
Avatar of dklauk

ASKER

UPDATE!

I got it to work using opener.parent.location=('trulyscrumptioussc.com/conmtact.asp').   The 'parent' attribute was what I needed in my scenario.

Thanks for your ideas and excellent detailed help.  I learned from it.

Darold
opener.location will allow you to go to any page of your web site or any other web site. Are you sure your contact.asp page is not kicking you back to index.asp? Perhaps your target browse requires the href field to be specified: opener.location.href = "trulyscrumptioussc.com/contact.asp";

Also, you don't need parentheses around the web address for opener.location.

You can take a look at http://www.quirksmode.org/js/croswin.html for more info.
Avatar of dklauk

ASKER

I use IE6 as my browser.  ALso I'm not sure what you mean by my" target browser requiring href field..."  Is there a setting in IE6 for this that I need to check?

Thanks, once again, for your excellent help.
I posted those suggestions at the same time you posted the fix with ".parent". I'm glad it's working now.