js中使用window.close()关闭页面时,发现chrome和firefox不起作用且firefox没有任何提示,很烦人。而chrome会报“Scripts may close only the windows that were opened by it”。
解决办法:
1.针对firefox:
firefox配置:地址栏输入about:config,修改属性“dom.allow_scripts_to_close_windows”为true;
2.针对chrome:
open(location, '_self').close();
相关推荐
让window.close()不提示对话框
Window.close()这句脚本是用来关闭当前窗口,如果是在window.open的窗口中执行Window.close(),将会很顺利地将窗口关闭,但如果是在一非window.open打开的窗口中执行Window.close(),将会弹出一个提示窗口,如下: ...
window.close(),一看就知道是用来关闭浏览器窗口的方法。W3CSchool对该方法的解释如下:方法 close() 将关闭有 window 指定的顶层浏览器窗口。某个窗口可以通过调用 self.close() 或只调用 close() 来关闭其自身...
window.close(); 关闭浏览器窗口js代码的总结介绍 序号 关闭代码 需要确认 无任何作用 无需确认 测试 1 window.close() IE7 firefox,chrome, safari Opera Close 2 window.opener=null; window.open(”,’_...
说起来window.close(),这也是个“不太让人省心”的角色。因为浏览器兼容性千差万别,还对他有诸多限制。
window.close(),只支持IE6不支持IE7的问题 打开新窗口并且关闭本窗口不弹出要关闭窗口前的提示function openWin(){window.open(‘login.jsp’,”,’fullscreen=yes,menubar=no,resizable=no’);window.opener=null;...
实现网页端<input accept="image/*" capture="camera" id=...在手机端拍照/图库上传,执行取消返回等操作报错问题都得以解决,还有对网页端window.open/close在手机端不反应问题都有解决方法,具体看操作说明。
<A class=a07 href="javascript:window.close()">关闭</A>
兼容各浏览器的通用关闭JS,兼容的浏览器有火狐、谷歌、IE等!
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭,强制关闭弹窗 } layer.closeAll(); //疯狂模式,关闭所有层 layer.closeA
主要介绍了FF(火狐)浏览器无法执行window.close()解决方案,需要的朋友可以参考下
采用两种弹出窗口实现方式: ...弹出窗口关闭的JS方法:window.close(); 示例请参照:demo.html 窗口内分页方法请参照:demoInPage.jsp (注:项目中使用时需要修改JS文件中,iFrame.jsp页面的路径)
window.close()在IE下可以执行关闭,但在Firefox下不关闭,不是JS代码window.close()的问题,而是Firefox的配置问题
window.close() || window.open() 一篇关于艺术在 Web 2.0 和语义网世界中的作用的多媒体文章。 由 Pablo Cárdenas Ramírez 为新媒体课程开发,2015-1 由 Carmen Gil Vrolijk 在 Universidad de los Andes 教授...
JS代码: window.open(); 而当支付成功后,需要关闭支付平台支付成功界面,并在客户端加载客户端支付成功页面,JS代码: window.opener.location.href=url;window.close();