bashegge
asked on
Changing URL of window from a POPUP
I have created a link on my page which creates a popup window with information regarding a specific topic.
I would like to create a link on the popup window which changes the URL of the underlying page (that is, the page which created the popup)
How do I do this?
Bas.
Here is a working example :
<html>
<head>
<title>about:blank</title>
<script language="javascript1.2">
<!-- copyright(c) avcoh@yahoo.com
var o= window.open("about:blank", "aa");
o.document.write("From the popup : <a href=\"javascript:opener.l ocation.hr ef='http://www.yahoo.com';return false;\">test<a/>");
-->
</script>
<style>
</style>
</head>
<body>
</body>
</html>
<html>
<head>
<title>about:blank</title>
<script language="javascript1.2">
<!-- copyright(c) avcoh@yahoo.com
var o= window.open("about:blank",
o.document.write("From the popup : <a href=\"javascript:opener.l
-->
</script>
<style>
</style>
</head>
<body>
</body>
</html>
Avner, quick question isn't this the same as href is the default property of location?
opener.location='http://www.yahoo.com'
am I wrong?
opener.location='http://www.yahoo.com'
am I wrong?
Basically yes, but I belive it's better practice to change the href property.
ASKER
I should have specified,
But the popup has to be opened from a link, not open automaticaly as your working example does.
Any help?
Bas
But the popup has to be opened from a link, not open automaticaly as your working example does.
Any help?
Bas
ASKER
I should have specified,
But the popup has to be opened from a link, not open automaticaly as your working example does.
Any help?
Bas
But the popup has to be opened from a link, not open automaticaly as your working example does.
Any help?
Bas
ASKER
Another thing,
I ALSO forgot to mention that I don't want to write the content of the popup screen from the main page [as in o.document.write()]
The link on category.asp opens a new window, information.asp. On information.asp there is a link which changes category.asp.
I hope that makes it a bit clearer.
To category.asp:
<script type="text/JavaScript">
window.open("information.a sp","PageT itleHere") ;
</script>
To information.asp (link which changes category.asp):
<a href="javascript:opener.lo cation.hre f='categor y.asp?para m1=a¶m 2=b'">Link </a>
-EEK
<script type="text/JavaScript">
window.open("information.a
</script>
To information.asp (link which changes category.asp):
<a href="javascript:opener.lo
-EEK
If you want to define the opening window (size, scrollbars etc.), Google gives you thousands of tutorials and examples: http://www.google.fi/search?q=javascript+window.open&ie=UTF-8&oe=UTF-8&hl=fi&lr=
This also helps: http://www.irt.org/xref/Window.htm#open()
--> see Window Properties
-EEK
This also helps: http://www.irt.org/xref/Window.htm#open()
--> see Window Properties
-EEK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: avner {http:#8145825}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jAy
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: avner {http:#8145825}
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
jAy
EE Cleanup Volunteer
<a href="javascript:opener.lo