• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric,

Its working fine now. Thanks man!

-Sajith
 
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic