473,320 Members | 1,949 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,320 software developers and data experts.

Problem with window.opener in Firefox/Mozilla

First a basic outline of what I am trying to do:

I want to have a page spawn a pop-up when you click "submit" on its
form. On this pop-up page there will be another form. When you click
"submit" on the pop-up's form I want the pop-up to close & a new page
to load in the "parent" window/page. I have this working in IE but
cannot get it to work in Firefox. The parent window correctly loads
the new page after submitting from the pop-up, however the pop-up will
not close. Here is what I have in my pop-up page:

<body bgcolor=#fffff0
onLoad="window.opener.name='mainPage';window.opene r.opener=window">

Basically giving a name to the parent window & then setting the parent
window's opener to the pop-up. Here is my form tag for the pop-up
page:

<form action=geturls.jsp target="mainPage" onSubmit="return
validate(this)">

So now the target of the submission from the pop-up is the initial
parent window. The next page which loads in the parent window (after
submitting from the pop-up) has the following body tag:

<body bgcolor=#fffff0 onLoad="javascript:window.opener.close()">

Since I set the pop-up as the opener of the parent window from the
pop-up html with the tag I show above, this should work. It does work
perfectly in IE but in Firefox the pop-up stays open & I get the
following javascript error:

window.opener has no properties

I am using Firefox 0.9.3.

I should also mention that the "validate()" method in pop-up needs to
return "true" if there are no validation errors with the pop-up's form
& then post the form to the main page since it loads a *different*
page (i.e. it doesn't just reload the page already loaded in the
parent window), so I cannot just call "window.close()" in the
validate() function.

Thanks!
Jul 23 '05 #1
1 15974
fogwolf wrote:
First a basic outline of what I am trying to do:

I want to have a page spawn a pop-up when you click "submit" on its
form. On this pop-up page there will be another form. When you click
"submit" on the pop-up's form I want the pop-up to close & a new page
to load in the "parent" window/page. I have this working in IE but
cannot get it to work in Firefox. The parent window correctly loads
the new page after submitting from the pop-up, however the pop-up will
not close. Here is what I have in my pop-up page:

<body bgcolor=#fffff0
onLoad="window.opener.name='mainPage';window.opene r.opener=window">

Basically giving a name to the parent window & then setting the parent
window's opener to the pop-up. Here is my form tag for the pop-up
page:

<form action=geturls.jsp target="mainPage" onSubmit="return
validate(this)">

So now the target of the submission from the pop-up is the initial
parent window. The next page which loads in the parent window (after
submitting from the pop-up) has the following body tag:

<body bgcolor=#fffff0 onLoad="javascript:window.opener.close()">

Since I set the pop-up as the opener of the parent window from the
pop-up html with the tag I show above, this should work. It does work
perfectly in IE but in Firefox the pop-up stays open & I get the
following javascript error:

window.opener has no properties

I am using Firefox 0.9.3.
It would appear that Firefox does not set window.opener when a window is
opened using the TARGET attribute alone. So open the window using
JavaScript and window.opener will be set appropriately (assuming the
window opens at all that is).

Variation on <url: http://jibbering.com/faq/#FAQ4_37 />:

<form action=geturls.jsp target="mainPage"
onSubmit="
if (validate(this)) {
window.open('', this.target);
return true;
} else {
return false;
}
"


--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

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

Similar topics

2
by: Johan Daine | last post by:
Hi everyone, I have a main page (search engine) that pops up a window in wich the user can select a keyword in a select box (up to 4 keywords) The on change attribute of the select tag calls the...
2
by: Raphael Bowen Giudice | last post by:
I'm opening a window in my main page using the window.open() function. With the new window opened, how do I call a function or an object from the main page. I'm using the window.opener() function...
7
by: Nick | last post by:
I've a main html file which will pop up a window with a image. In the main Window, I have the following code: w = window.open('popup.html') alert(w.document.images.length) And the alert shows...
4
by: Derek | last post by:
I have the following script in a page and it gets an error in IE 6. Says something about an invalid argument but the line number doesn't help since I can't see the javascript code when viewing...
5
by: Hemanth | last post by:
Hello there, I'm running a script that opens a popup window (which is basically a form with checkboxes and a submit button). When I click the submit button I want to run a PHP script and target...
3
by: Roger Withnell | last post by:
I am using the following function to open a new window in which to display a larger image on clicking a thumbnail image. function OpenNewWindow(src, vName, vWidth, vHeight, ......) { var...
37
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible to do a window.close after opening a window,...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...

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.