使用JavaScript / jQuery的密切的.aspx [英] close .aspx using JavaScript/ Jquery
本文介绍了使用JavaScript / jQuery的密切的.aspx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已搜查这个问题像结果<一个其他链接href=\"http://stackoverflow.com/questions/19761241/window-close-and-self-close-do-not-close-the-window-in-chrome\">window.close而self.close不要关闭窗口,在Chrome浏览器等,但也没有能够解决它结果
我想关闭使用下面code页,但它不工作在任何浏览器。
I have searched this issue on other links like
window.close and self.close do not close the window in Chrome etc. but couldn't able to solve it
I want to close a page using below code, but it's not working on any browser.
我的网址是这样的:
HTTP://server/solutionName/Confirmation.aspx
警告
脚本可能会关闭只能由它已打开的窗口。
Scripts may close only the windows that were opened by it.
HTML
<img alt="Close" src="images/close.png" onclick="return confirm_delete();">
脚本
function confirm_delete()
{
if (confirm("Are you sure you want to close?") == true)
window.close();
else
return false;
}
下面是截图:
Here is the screenshot:
推荐答案
尝试code以下行
var Browser = navigator.appName;
var indexB = Browser.indexOf('Explorer');
if (indexB > 0) {
var indexV = navigator.userAgent.indexOf('MSIE') + 5;
var Version = navigator.userAgent.substring(indexV, indexV + 1);
if (Version >= 7) {
window.open('', '_self', '');
window.close();
}
else if (Version == 6) {
window.opener = null;
window.close();
}
else {
window.opener = '';
window.close();
}
}
else {
window.close();
}
这篇关于使用JavaScript / jQuery的密切的.aspx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文