Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parent.close not working in firefox 1

Status
Not open for further replies.
Joined
Jul 28, 2005
Messages
358
Location
FR
Hi,

I have a page that is made using frames, at the bottom it has a close window lik that is made using a javascript parent.close() function.

It works fine in IE, but in Firefox it doesn't close and using the DOM inspector I get the error "Scripts may not close windows that were not opened by script.".

Is there anyway of getting the link to close the browser window in both IE and FF? I have tried the parent.window.close() function but it is exactly the same.

Thanks,

Richard
 
i think that FF's behaviour is correct and that IE's (as often the case) is incorrect.

perhaps a solution might be to open the base window by javascript in the frameset. then your script could close it again just fine.
 
Not quite sure how you mean.

If it's any help, the page is opened by a link from another site that I have absolutely no control of.

I could (and probably should) rewrite the page so it doesn't use frames anyway, and that migt help.

Richard
 
i think i understand now.

what you want to achieve is a button on your page that will close the entire window on clicking. the window is not spawned by javascript but by a normal link.

sfaik, in a properly constructed browser you can't do this: too much scope for malicious practice!

i don't think that migrating to a non-frames architecture will resolve the problem, i'm afraid.
 
yep, don't like it myself anyway, especially the very annoying message that comes up in IE. Good that FF is sensible in how they don't allow it.

I suppose I could just leave it as most of the visitors use IE, but it would be nice to be able to do it in FF.

Thanks for the help, and pointing out it can't be done. I'll be able to report back with that if they start asking why it doesn't work!!

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top