首页 > 代码库 > js 关闭页面(Scripts may close only the windows that were opened by it.)
js 关闭页面(Scripts may close only the windows that were opened by it.)
传送http://blog.csdn.net/kuangfengbuyi/article/details/52052301
js关闭当前页面,当该页面不是其他页面打开的,而是直接输入url,
直接用window.close()无法关闭。
以下代码可以实现不同浏览器的关闭操作:
function closewin(){ if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") !=-1) { window.location.href="about:blank"; window.close(); } else { window.opener = null; window.open("", "_self"); window.close(); } }
location对象
function currLocation() { alert(window.location) } function newLocation() { window.location="/index.html" }
js 关闭页面(Scripts may close only the windows that were opened by it.)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。