Monday, May 20, 2024
26
rated 0 times [  32] [ 6]  / answers: 1 / hits: 63315  / 13 Years ago, tue, october 11, 2011, 12:00:00

I have been researching this problem and while there's lots of posts on various forums about similar problems, none of the problems or solutions exactly match mine.



I have an application that has been successfully using the function below to redirect back to the parent window once finished with a popup. Recently I have been investigating compatibility with other browsers (to allow the system to be used via iPad) and have found that there is a problem with this function when using Safari or Chrome.



The parent page is a summary of some databased info, and the user clicks a link to open a window (via window.open) to view more detailed data. When finished there is a link on the child window that refreshes the data on the parent (partly to ensure the correct data is displayed when you return to the parent) and closes the child.



The Console in Safari reports the result of 'window.opener.location.href' is not a function. I have tried to use the above and 'window.opener.document.location.href' and 'window.opener.window.location.href' (taken from other solutions offered up on the net) but with no success.



I know that some people have this function working well, while others have this sort of problem. I'm wondering if there are any answers to this specific situation.



Here is my function:



function quicklink(url) {
window.opener.document.location.href(url);
self.close();
}


This has worked from day one on IE7,8 and 9 but doesn't work in Safari (for windows or iPad) or Chrome.



Any ideas?


More From » google-chrome

 Answers
-2

href is a property, not a method. Just assign the URL to it:



window.opener.document.location.href = url;


This will work in IE also. It's a property there too, even if it lets you use it as a method.


[#89686] Sunday, October 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jeffn

Total Points: 559
Total Questions: 81
Total Answers: 103

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;