based on some actions in a page , I want to give an alert message to the user (ie.. your resume has been uploaded.) like that and i want to close that window, when the user clicks okay in that alert box. I want to do this using alert method only instead of confirm method in javascript. why because alert method gives the only option "ok" where as confirm method gives " yes or no" .can anyone help me please.
Asked
Active
Viewed 2.1k times
3
-
2Script may not close the window that were not opened by script – bugwheels94 Jul 10 '13 at 09:34
1 Answers
7
Just put the statements one after each other :
alert("ok");
window.close();
EDIT following Ankit's remark to OP : note that if you didn't open the window with Javascript yourself, you may not be authorized to close it depending on the browser.

Laurent S.
- 6,816
- 2
- 28
- 40