window.opener.location.href does not work on Mac.

A

alison

I am trying to redirect the parent page when the user clicks an html
button in an aspx page by using the javascript:
window.opener.location.href="EditOrders.aspx"; This works fine on IE
for windows or Firefox, however on IE for Mac or Safari on Mac, it
doesn't work. If I enable script errors on IE for Mac, I get:
'window.opener.location' is not an object. Any ideas on how to get this
to work on Mac browsers? Thanks!
 
V

VK

alison said:
I am trying to redirect the parent page when the user clicks an html
button in an aspx page by using the javascript:
window.opener.location.href="EditOrders.aspx"; This works fine on IE
for windows or Firefox, however on IE for Mac or Safari on Mac, it
doesn't work. If I enable script errors on IE for Mac, I get:
'window.opener.location' is not an object. Any ideas on how to get this
to work on Mac browsers?

Try instead window.opener.document.location.href="EditOrders.aspx";
(this is not better and you variant is more correct, but just to sort
out all options).
 
A

alison band

Thanks, but that still doesn't work. If I enable IE on Mac to display
script errors, it displays: "'window.opener.document' is not an object".
 
T

Thomas 'PointedEars' Lahn

alison said:
I am trying to redirect the parent page when the user clicks an html
button in an aspx page by using the javascript:

Hopefully you are not using the `javascript:' label here as that would
be either useless or error-prone.
window.opener.location.href="EditOrders.aspx"; This works fine on IE
for windows or Firefox, however on IE for Mac or Safari on Mac, it
doesn't work. If I enable script errors on IE for Mac, I get:
'window.opener.location' is not an object. Any ideas on how to get this
to work on Mac browsers? Thanks!

Try alert(window) and alert(window.opener) to see if both refer to an
object. If either does not, it would be prudent if you posted how you
opened the new window. If it does, try alert(window.opener.location).
If that returns the URL of the document displayed in the opening window,
try

if (window.opener && !window.opener.closed)
{
window.opener.location = "EditOrders.aspx";
}

instead.


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top