I have a application form when I submit the form it is redirecting to window which have options "print" and close.
Please click <a onclick="self.close();" href="#">here</a> to close this window.
If I click on close,the tab itself closing in chrome and IE but it not working in Mozilla.
When I use this code,
Please click <a onclick="CloseWindow();" href="#">here</a> to close this window.
<script type="text/javascript">
function CloseWindow() {
open(location, '_parent').close()
}
</script>
it is redirecting to apply online page.
How I will close the tab itself.
self.close();
is working for IE and Chrome but in Mozilla it shows the error:
Scripts may not close windows that were not opened by script.
Or can we make ' dom.allow_scripts_to_close_windows, true;' using c# or javascript?
I have a application form when I submit the form it is redirecting to window which have options "print" and close.
Please click <a onclick="self.close();" href="#">here</a> to close this window.
If I click on close,the tab itself closing in chrome and IE but it not working in Mozilla.
When I use this code,
Please click <a onclick="CloseWindow();" href="#">here</a> to close this window.
<script type="text/javascript">
function CloseWindow() {
open(location, '_parent').close()
}
</script>
it is redirecting to apply online page.
How I will close the tab itself.
self.close();
is working for IE and Chrome but in Mozilla it shows the error:
Scripts may not close windows that were not opened by script.
Or can we make ' dom.allow_scripts_to_close_windows, true;' using c# or javascript?
Share Improve this question edited Aug 31, 2015 at 10:10 asked Aug 24, 2015 at 12:57 user4961104user49611042 Answers
Reset to default 2Why are you using that way? Just use:
function CloseWindow() {
window.parent.close();
}
Or, you can use:
function CloseWindow() {
window.close();
}
If you are using script in HTML wrap it with tag like:
Please click <a onclick="CloseWindow();" href="#">here</a> to close this window.
<script type="text/javascript">
function CloseWindow() {
window.parent.close();
}
</script>