<script> function closeMe() { var win=window.open("","_self"); win.close(); } </script> <html> <body> <form> <input type="button" name="Close" onclick="closeMe()" /> </form> </body> </html>We can also write script like this
function winClose() { window.top.opener=null; window.close(); } or function closeWindow() { window.open('','_parent',''); window.close(); }
PLEASE ADVISE WHAT CAN BE A RESOLUTION, CHROME GIVES AND ERROR AS "wE CAN CLOSE ONLY THOSE WINDOWS THAT ARE OPENED VIA SCRIPT"
tHANKS
GATIM
If you put the script tag actually inside the html then it works. I have just tried it.
<html>
<head>
<script> function closeMe() { var win=window.open("","_self"); win.close(); } </script>
</head> <body> <form> <input type="button" name="Close" onclick="closeMe()" /> </form> </body>
<html>
<head>
<script> function closeMe() { var win=window.open("","_self"); win.close(); } </script>
</head> <body> <form> <input type="button" name="Close" onclick="closeMe()" /> </form> </body>
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "Close_Window", "self.close();", True)ScriptManager.RegisterStartupScript(Me, Me.GetType(), "callJSFunction", "closeWindow();", True)ScriptManager.RegisterStartupScript(Me, Page.GetType, "ClosePage", "window.open('window.close();', '_self', null)", True)
Thanks Ganesh. I have tried these before and none of them work in Chrome. These work in IE, Edge and also Firefox (with a setting change) but not chrome. Do you have any other suggestion?
--ScriptManager.RegisterStartupScript(Me, Me.GetType(), "Close_Window", "self.close();", True)ScriptManager.RegisterStartupScript(Me, Me.GetType(), "callJSFunction", "closeWindow();", True)ScriptManager.RegisterStartupScript(Me, Page.GetType, "ClosePage", "window.open('window.close();', '_self', null)", True)
You received this message because you are subscribed to the Google Groups "Chromium-Apps-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-apps+unsubscribe@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "Chromium-Apps-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-apps+unsubscribe@chromium.org.
Thanks Ganesh. I have tried these before and none of them work in Chrome. These work in IE, Edge and also Firefox (with a setting change) but not chrome. Do you have any other suggestion?
ScriptManager. RegisterStartupScript(Me, Me.GetType(), "Close_Window", "self.close();", True)ScriptManager. RegisterStartupScript(Me, Me.GetType(), "callJSFunction", "closeWindow();", True)ScriptManager. RegisterStartupScript(Me, Page.GetType, "ClosePage", "window.open('window.close();' , '_self', null)", True)
--
You received this message because you are subscribed to the Google Groups "Chromium-Apps-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-apps+unsubscribe@ chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at https://groups.google.com/a/ chromium.org/group/chromium- apps/.
For more options, visit https://groups.google.com/a/ chromium.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "Chromium-Apps-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-apps+unsubscribe@ chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at https://groups.google.com/a/ chromium.org/group/chromium- apps/.
For more options, visit https://groups.google.com/a/ chromium.org/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-apps+unsubscribe@chromium.org.