• 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

window.opener not working for FIREFOX.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Members
I need very urgent help on the following code.
I have a login form which calls the "adminLog(obj)" function and logged the user and where as window.opener will contact the object for window.open(";....")
and I have another onload method called "Set_focus()" on refreshing the page it will check for window.opener is null or not and if its not null then it will close the associtate window. Follow the code below please.

function adminLog(obj)
{
var loginid = encode64(obj.loginidAdmin.value);
var pswd = encode64(obj.passwdAdmin.value);

obj.reset();

window.opener =
window.open("UserAdminPage.jsp?loginid="+loginid+"&passwd="+pswd);
}

function set_focus()
{

if(window.opener != null)
{
window.opener.close();
}
else
{}

document.forms[0].reset();
document.forms[0].elements[0].focus();
}

Above code works perfect for IE but doesn't work for Firefox, can any one help me on this, I want to close the window which gets open by window.open, when ever user refresh the parent window, and this work fine in IE but its not working in Firefox. ANY HELP IS HIGHLY APPREICATED.

Thanks in advance.
Mohammed Zubedi
mohammed.zubedi@xius-bcgi.com
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you getting any error messages in the "Tools -> Error Console" window?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not close a window that you did not open with JavaScript. So you should not be able to close the parent window. I am not sure why IE is alowing you to do that. [What version are you using? IE6 sp1?]

Eric
 
mohammed zubedi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IE Version is 7. (IE7).
I'm not getting any error messages at all.
is there any possible way to make this code work with firefox as well?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same problem a few days back (I am not a javascript guy!)
My requirement was to close the window when the user clicks on an image.
Just like you I figured out that if the window is not opened by a script, it cannot be closed. Fortunately (for me) the client is using IE and I dropped the matter.

However, during my extensive googling, I came accross some post which said it was because of this line

(Unfortunately I cannot recall the article link)

One of the possible solutions could be setting this to true, but then I dont know what else might be affected. Like I said, I am not a javascript guy.

PS. The above line is from the <MOZILLA_HOME>/greprefs/all.js. I have FF 2.0.0.16
 
mohammed zubedi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maneesh Godbole, I tried those options earlier but still its' not working, moreover I'm working on our own product which has to be compatible on both Firefox and IE, but its not working on FF, is there any any any ways where I can make it done, I have been trying this for past one week and no results .

Anyways, Thanks for your suggestions.

Mohammed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic