This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes closing window automatically using JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "closing window automatically using JavaScript" Watch "closing window automatically using JavaScript" New topic

closing window automatically using JavaScript

avinash narasingam

Joined: May 08, 2012
Posts: 6
does anyone know how to close the window automatically without having a prompt or alert box .
if we try window.close() a alert box is displayed asking yes or no to close the window
i dont want the confirmation message.
but window should be closed
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63206

If you didn't open the window yourself, then it's not your window to do with as you please and you can't close it without alerting the user. Why would you want to be so unfriendly?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
avinash narasingam

Joined: May 08, 2012
Posts: 6
First of all sorry for posting in the wrong forum
Secondly i am the user,when i click on a button(export to pdf) a new window (empty)is opening and also a pdf format page..i just want the pdf page,,
the empty window page should be closed automatically without asking for an alert
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Open the pdf into a hidden iframe.

I agree. Here's the link:
subject: closing window automatically using JavaScript
It's not a secret anymore!