473,385 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using window open to change existing window's location

Hi,

I'm trying to change the content of an existing window from a second window
using window.open(). This works fine in Netscape 7, but IE 6.0 returns an
error, saying there's an invalid parameter. If I omit the target window's
name, everything works fine except that my document is opened in a new
window.

window.open("somescript.php", "existing_target_window");

Can anybody see what's wrong with that?

Thanks,
Bernd
Jul 20 '05 #1
3 5832
Bernd Liebermann wrote:
Hi,

I'm trying to change the content of an existing window from a second
window using window.open(). This works fine in Netscape 7, but IE 6.0
returns an error, saying there's an invalid parameter. If I omit the
target window's name, everything works fine except that my document is
opened in a new window.

window.open("somescript.php", "existing_target_window");

Can anybody see what's wrong with that?

Thanks,
Bernd


Hi,

Do it like this:

var myOtherWin;

if (myOtherWin) {
// already is open
myOtherWin.location="blabla.php";
} else {
// create it
myOtherWin = window.open("somescript.php", "existing_target_window");
}

So the trick is to keep a reference to that window.

Regards,
Erwin Moller

Jul 20 '05 #2
Erwin,

the problem ist that my second window has been opened by the first, so I
don't know how to get a reference to the first that I could use in the
second as there is no global windows collection. Any further ideas?

Thanks,
Bernd Liebermann

"Erwin Moller"
<si******************************************@spam yourself.com> schrieb im
Newsbeitrag news:40*********************@news.xs4all.nl...
Bernd Liebermann wrote:
Hi,

I'm trying to change the content of an existing window from a second
window using window.open(). This works fine in Netscape 7, but IE 6.0
returns an error, saying there's an invalid parameter. If I omit the
target window's name, everything works fine except that my document is
opened in a new window.

window.open("somescript.php", "existing_target_window");

Can anybody see what's wrong with that?

Thanks,
Bernd


Hi,

Do it like this:

var myOtherWin;

if (myOtherWin) {
// already is open
myOtherWin.location="blabla.php";
} else {
// create it
myOtherWin = window.open("somescript.php", "existing_target_window");
}

So the trick is to keep a reference to that window.

Regards,
Erwin Moller

Jul 20 '05 #3
Bernd Liebermann wrote:
Erwin,

the problem ist that my second window has been opened by the first, so I
don't know how to get a reference to the first that I could use in the
second as there is no global windows collection. Any further ideas?

Thanks,


Hi Bernd,

try 'opener'

opener holds a reference to the window that opened the one that is using
opener.

so:
win1 opens win2
from win2 you get a reference to win1 by:

opener.document.location="Doughlas_Adams.html";

There are a few securityrestrictions: if the content in win1 and win2
originate from different domains, some browsers will block cross-window
javascript.

Good luck!

Regards,
Erwin
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: -DRB- | last post by:
Hi all, I'm very much an amateur designing a page (for free!) for a friend, so any help offered would be hugely appreciated. I'm aiming to open a maximised window (and isn't that fun...) and...
17
by: Michael Hill | last post by:
I created an element on-the-fly using javascript like: myA=document.createElement("A"); myA.href="Javascript:acton(this)"; myA.className = "smallLink";...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
2
by: ENIZIN | last post by:
I am having an interesting problem where I am simply trying to put in country selection popup window on my site. When the user closes the window the popup should call the...
1
by: DaveG | last post by:
Hi All I am having a small problem with window.open() obviously something I am or am not doing. This is being fired from a subwindow. Everytime I use just the location.href = "URL" I got a...
2
by: Joe D Williams | last post by:
Thanks for the link to: http://www.w3.org/TR/Window Reading further, it seems like some input is needed: 1.2. Not in This Specification * ISSUE-59: Should Window 1.0 include history?...
4
by: mantrid | last post by:
In some of my script ive been using the followin if(isset($_POST)){ header("Location: http://www.mysite.co.uk/path/my.php"); } This changes the page in the open browser window. How can I...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.