Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to change the location of popup window in Netscape and Opera

 
Sajith Varghese
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am opening a popup window and on click of a link on the popup window trying to change the location of the popup window. I tried all these options below.

window.document.location
document.location
document.location.href
location.href
document.location.replace(url)
location.replace(url)
self.location

But none of the above options is working for Netscape (7.1) and Opera (7.54). It works fine in IE (6.0).

Please advise.

Thanks in advance.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changing the location of the pop up window from itself should be like any other window.

What is the line of code to open the window?

Eric
 
Sajith Varghese
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also thought like that. This is the code that I use to open the window.

twin = window.open("","timeout_window","toolbars=no,location=no,menubar=no,resizable=no,scrollbars=no,width=500,height=250,screenX=150,screenY=175,left=150,top=175");

A variable called sd is then defined to contain the html needed to be displayed on the popup. The following line is then executed to display the popup html text.

twin.document.write(sd);

The popup html has a link which on click calls a javascript method of twin (popup) called renew(). Inside renew(), I am trying to change the location of popup which is not happening in Netscape (7.1/7.2) and Opera (7.54). It works properly in IE 6.0.

The parent window url is getting reloaded in the popup window location in Netscape and Opera.

Thanks again.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you closing the document after writing it?



Eric
 
Sajith Varghese
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not closing the document. Is it mandatory to close the document?

This is how I call the method renew() that I use to change the location.

A href='#' onKlick='renew()' (K is used instead of C for posting)

I am not sure if I have to use like

A href='javascript:renew()'

Thanks again.

[ February 16, 2005: Message edited by: Sajith PV ]
[ February 16, 2005: Message edited by: Sajith PV ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
closing the document after writing information is a good thing. It tells the browser it is done and it finishes the rendering fully.

You should call links like

<a href="javascript:yourFunction()">Link</a>

events should be

onclick="yourFunction()"

Eric
 
Sajith Varghese
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,

Its working fine now. Thanks man!

-Sajith
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic