www.webdeveloper.com
Results 1 to 5 of 5

Thread: close browser window with html?

  1. #1
    Join Date
    Nov 2004
    Posts
    3

    Question close browser window with html?

    I'm not sure if this is an html issue but here goes. This might be really simple, but is there a way to close a browser window by clicking on an image? How is this done? Thanks!

  2. #2
    Join Date
    Mar 2004
    Posts
    3,056
    No. You can't close a browser window with html. You can however close it with javascript.

    something along the lines of
    PHP Code:
    <img src="blah.png" alt="meh" onclick="window.close()"
    Something like that anyway. I'm not to hot on the ol' javascript. I avoid using it as much as possible.

  3. #3
    Join Date
    Nov 2004
    Posts
    3
    You're right, this closes the browser window. But before it closes a dialog box comes up asking you to confirm the close. How do you close the window without that annoying dialog box?

  4. #4
    Join Date
    Aug 2003
    Location
    In my house
    Posts
    4,004
    Unless the window was opened by you with the window.open() method, you're out of luck.

  5. #5
    Join Date
    Jan 2004
    Posts
    2,422
    Originally posted by josh42
    You're right, this closes the browser window. But before it closes a dialog box comes up asking you to confirm the close. How do you close the window without that annoying dialog box?
    Would you want your browser to randomly close? It has to ask, otherwise you would be stepping on the user's toes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles