Link to home
Start Free TrialLog in
Avatar of bashegge
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.
Avatar of avner
avner

From the popup :
<a href="javascript:opener.location.href='http://www.yahoo.com'>test<a/>
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.location.href='http://www.yahoo.com';return false;\">test<a/>");
-->
</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?
Basically yes, but I belive it's better practice to change the href property.
Avatar of bashegge

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
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

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.asp","PageTitleHere");
</script>

To information.asp (link which changes category.asp):

<a href="javascript:opener.location.href='category.asp?param1=a&param2=b'">Link</a>

-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
ASKER CERTIFIED SOLUTION
Avatar of avner
avner

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
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