GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Unable to change the location of popup window in Netscape and Opera Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Unable to change the location of popup window in Netscape and Opera" Watch "Unable to change the location of popup window in Netscape and Opera" New topic
Author

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

Sajith Varghese
Greenhorn

Joined: Feb 15, 2005
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Feb 15, 2005
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you closing the document after writing it?



Eric
Sajith Varghese
Greenhorn

Joined: Feb 15, 2005
Posts: 6
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Feb 15, 2005
Posts: 6
Hi Eric,

Its working fine now. Thanks man!

-Sajith
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to change the location of popup window in Netscape and Opera