How can I close a browser window without receiving the Do you want to close this window prompt?
The prompt occurs when I use the window.close();
function.
How can I close a browser window without receiving the Do you want to close this window prompt?
The prompt occurs when I use the window.close();
function.
Create a JavaScript function
Now write this code and call the above JavaScript function
Or simply:
This works for me.
I am going to post this because this is what I am currently using for my site and it works in both Google Chrome and IE 10 without receiving any popup messages:
I have a function on my site that I want to run to save an on/off variable to session without directly going to a new page so I just open a tiny popup webpage. That webpage then closes itself immediately with the
onload="window.close();"
function.In the body tag:
To close the window:
Tested on Safari 4.0.5, FF for Mac 3.6, IE 8.0, and FF for Windows 3.5
Because of the security enhancements in IE, you can't close a window unless it is opened by a script. So the way around this will be to let the browser think that this page is opened using a script, and then to close the window. Below is the implementation.
Try this, it works like a charm!
javascript close current window without prompt IE
javascript close current window without prompt IE
In my situation the following code was embedded into a php file.
So I opened the console and write the following
This solved the problem. So, find out the JavaScript code and find the variable(s) and assign them to an appropriate "value" which in my case was "false"