473,654 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

window.opener Issue with Firefox

I already read about several problems using firefox and the
window.opener property. But obviously it didn't help out. So here is
my problem:

I got a "Search..." link which opens a new window with an FTP-browser.

function popup(url,width ,height){
var popupX = (screen.width/2)-(width/2);
var popupY = (screen.height/2)-(height/2);
var pos = "left="+popupX+ ",top="+pop upY;

winpops=window. open(url,"popup ","width=" + width + ",height=" +
height + "," + pos + ",scrollbars=ye s,toolbar=yes") ;
}

this code opens my popup. Now, the user browses his FTP and selects
some kind of folder or file. This value is automatically saved into a
readonly input form. To accept the selected path, the user got a form
button, which saves the path to the parent form (window.opener) and
closes the FTP-browser.

function acceptPathAndCl ose(path,formna me,field) {
form_h = eval("opener." + formname + "." + field);
form_h.value = path;
self.close();
}

Firefox spams its JavaScript console with "opener.bla bla got no
properties" and just does nothing. Internet Explorer executes this
code as expected. How can i solve this annoying problem?

Greets
Stefan
Jul 23 '05 #1
2 18404


Stefan Sch?rmeli wrote:

function acceptPathAndCl ose(path,formna me,field) {
form_h = eval("opener." + formname + "." + field);
form_h.value = path;
self.close();
}

Firefox spams its JavaScript console with "opener.bla bla got no
properties" and just does nothing.


You need to learn the proper way to address form elements:
windowObject.do cument.forms.fo rmName
or
windowObject.do cument.forms['formName']
so in the above function you want
var form_h = opener.document .forms[formname].elements[field];
that way the form and the control are addressed properly in all browsers
starting from Netscape 3.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen wrote:
Stefan Sch?rmeli wrote:
function acceptPathAndCl ose(path,formna me,field) {
form_h = eval("opener." + formname + "." + field);
form_h.value = path;
self.close();
}

Firefox spams its JavaScript console with "opener.bla bla got no
properties" and just does nothing.


You need to learn the proper way to address form elements:
windowObject.do cument.forms.fo rmName
or
windowObject.do cument.forms['formName']
so in the above function you want
var form_h = opener.document .forms[formname].elements[field];
that way the form and the control are addressed properly in all browsers
starting from Netscape 3.


Although

var form_h = opener.document .forms[formname].elements[field];

may fail in Internet Explorer if you attempt to do anything other than
access the form control's value. For example, if -field- is a <select> and
you attempt to add or remove(?) Option() objects from it via a new window,
you will not be able to.

For example:

var form_h = opener.document .forms[formname].elements[field];
form_h[form_h.length] = new Option(text, value);

would fail in Internet Explorer with "access denied". The way to achieve the
same result is with:

opener.someFunc tionInOpener(fo rmname, field, text, value);

Then in the opener window you'd have:

function someFunctionInO pener(fn, f, t, v) {
var form_h = document.forms[fn].elements[f];
form_h[form_h.length] = new Option(t, v);
}

Untested.

--
Grant Wagner <gw*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

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

Similar topics

1
16021
by: fogwolf | last post by:
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,...
1
5251
by: humbads | last post by:
I am trying to get a popup window to work for editing notes in my application. Here's how I implemented it: The original frame is called ORIGINALFRAME and contains a link like this: <a href="javascript:launchwin();">Edit Note</a> function launchwin() { // ... custom stuff newNoteWindow = window.open(strURL,'NoteWindow',strOptions);
7
2853
by: MrFez | last post by:
Through some investigation it appears that selecting "Every visit to the page" for the IE caching setting "Check for new version of stored pages" causes the window.opener property of child windows to be set to null after the main page has excuted a postback. Can anyone explain this or at show that I'm wrong ? Is this a bug in IE ?
3
10714
by: alison | last post by:
I am trying to redirect the parent page when the user clicks an html button in an aspx page by using the javascript: window.opener.location.href="EditOrders.aspx"; This works fine on IE for windows or Firefox, however on IE for Mac or Safari on Mac, it doesn't work. If I enable script errors on IE for Mac, I get: 'window.opener.location' is not an object. Any ideas on how to get this to work on Mac browsers? Thanks!
4
2503
by: badaczewski | last post by:
The following javascript appears on a popup window. <script language="javascript" type="text/javascript"> function InsertContact(value) { window.opener.CallBackContact(value); window.close(); } </script>
5
7524
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you click the attach it should upload file and close the window and send back control to Main page.. But it is not happening.. CODE: ========= <script LANGUAGE="JavaScript"> if ((window.opener != null) && (! window.opener.closed)) {
3
4067
by: Asterix | last post by:
Hi Guys, I know this is probably an easy one, but I am having issues. Basically, I have a pop-up (child) that controls the parent window. Clicking on a link on the child window should redirect the parent. Unfortunately, I cannot get it to work with FireFox after selecting more than one option. Javascript code: function MM_openBrWindow(theURL,winName,features) {
29
3897
Frinavale
by: Frinavale | last post by:
I have 2 FireFox (version 2) browser windows opened. One is the child of the other. When the user is finished with the child window, a method in the parent window is called to refresh a section of the page. This is the JavaScript code that I'm using to refresh the content in the parent page: <script type="text/javascript"> function UpdateList() {
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.