Results 1 to 8 of 8
  1. #1
    Join Date
    May 2008
    Location
    USA
    Posts
    114
    Hello,
    I created a web page include a button, and I added onclick event on the button to close the window, but the button works well on IE, but it doesn't work on Firefox
    any help??

  2. #2
    Join Date
    May 2008
    Location
    London
    Posts
    33
    Tell us what the error is? Use something like FireBug to see it if you can't already.
    Jay

  3. #3
    Join Date
    May 2008
    Location
    USA
    Posts
    114
    Hi Jay,
    It doesn't return any error
    my code as the following:
    <html>
    <head>
    </head>
    <body>
    <input type="button" value="close" onclick="window.close();"/>
    </body>
    </html>
    I read somewhere while I was searching that in Firefox I can't close a window via javascript unless I open it via javascript

  4. #4
    HivelocityDD Guest
    Can you please try this
    onclick=\"javascript:window.open('','_parent','');window.close();\"
    This should work both with IE and firefox
    Cheers !

  5. #5
    Join Date
    May 2008
    Location
    USA
    Posts
    114
    nop,
    It didn't work

  6. #6
    HivelocityDD Guest
    If you are using older version of firefox it should work. But for higher versions above 2.2 it wont work I think.
    Can you please try this
    <input type="button" value="close" onclick="javascript:window.opener='x';window.close();"/>
    Let me know if you have any luck with this please..

  7. #7
    Join Date
    May 2008
    Location
    USA
    Posts
    114
    no good news, not working

  8. #8
    Join Date
    Feb 2006
    Location
    top: 50px; left: 200px;
    Posts
    213
    I read somewhere while I was searching that in Firefox I can't close a window via javascript unless I open it via javascript
    Thats correct
    To use the close method in FF you must use the open method..

  9. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •