Scripts may close only the windows that were opened by it
关闭当前窗体报以下js错误:
Scripts may close only the windows that were opened by it
(脚本只能关闭由它打开的窗口)
使用场景,在js中关闭页面的js,如下:
window.opener = null;
window.open('', '_self');
window.close();
未能通过。
关闭页面的代码写在一个ajax返回的结果中的,如下:
$.ajax({
type: 'post',
url: "url",
success: function (data) {
if (data.isOut) {
window.opener = null;
window.open('', '_self');
window.close();
}
else {
alert(data.msg);
}
},
error: function (err) {
alert("异常:" + err);
}
})
解决办法:
window.location.href="about:blank";
window.close();
成功关闭。
Scripts may close only the windows that were opened by it的更多相关文章
- 脚本不得关闭非脚本打开的窗口。Scripts may close only the windows that were opened by it
今天脚本了里写了一句话: window.close() 但是浏览器却报了警告提示:Scripts may close only the windows that were opened by it,而 ...
- scripts may close only the windows that were opened by it 浏览器JS控制无法关闭当前页面
非window.open形式打开的子页面用js的window.close在chrome下就会提示scripts may close only the windows that were opened ...
- js 关闭页面(Scripts may close only the windows that were opened by it.)
传送http://blog.csdn.net/kuangfengbuyi/article/details/52052301 js关闭当前页面,当该页面不是其他页面打开的,而是直接输入url, 直接用w ...
- js关闭浏览器的tab页(兼容)
由于在脚本中使用了 window.close(), 当前非弹出窗口在最新版本的chrome和firefox里总是不能关闭,而在 IE中是可以关闭的 . 在console中弹出提示"Scrip ...
- 【温故而知新-Javascript】窗口效果 (全屏显示窗口、定时关闭窗口)
1.全屏显示窗口 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...
- chrome浏览器关闭标签页面
chrome浏览器关闭标签页提示:Scripts may close only the windows that were opened by it. 解决办法:通过open方法进行关闭. open( ...
- 【经验】JavaScript
1.function closeWin(){ window.open('','_self'); window.opener=null; // window. ...
- chrome JS关闭当前页无效问题
如果没有父窗口,JS中 window.opener = null; window.open("", "_self"); window.close(); 对chr ...
- 谷歌浏览器禁止window.close的问题
当一个窗口不是通过window.open或者window.showModalDialog打开的时候,调用JS的window.close() 谷歌浏览器会提示如下警告,并拒绝执行 Scripts may ...
随机推荐
- ThinkPHP框架知识
php框架 一.真实项目开发步骤: 多人同时开发项目,协作开发项目.分工合理.效率有提高(代码风格不一样.分工不好) 测试阶段 上线运行 对项目进行维护.修改.升级(单个人维护项目,十分困难,代码风格 ...
- Java多线程面试题整理
部分一:多线程部分: 1) 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序员可以通过它进行多处理器编程,你可以使用多线程对运算密集型任务提速. ...
- 性能测试 CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据
CentOS下结合InfluxDB及Grafana图表实时展示JMeter相关性能数据 by:授客 QQ:1033553122 实现功能 1 测试环境 1 环境搭建 2 1.安装influxdb ...
- 使用Visual Studio Team Services敏捷规划和项目组合管理(六)——VSTS仪表盘的使用
使用Visual Studio Team Services敏捷规划和项目组合管理(六)--VSTS仪表盘的使用 仪表盘使团队能够看到项目的状态和监控项目的进展.简单来说,不必深入到团队项目站点的其他部 ...
- ERP承接新后台优惠规则问题
一.后台在哪配置优惠规则? 1.设置优惠时间段: 2.添加优惠活动: 关于自动和手动: 自动:创建后,ERP同步数据后即生效. 点餐,活动会自动生效,自动计算金额. 手动:创建后,ERP需要手 ...
- Linux如何查看YUM的安装目录
Linux下如何查看使用YUM安装过的包的安装路径呢? 在搞清楚这个问题前,我们先来了解一下YUM. YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和R ...
- mssql sqlserver in 关键字在值为null的应用举例
转自:http://www.maomao365.com/?p=6873 摘要: 下文通过案例分析in 关键字在值为null的应用举例, 分析出not in关键字在null值产生的异常信息 如下所示: ...
- MSSQL Sql加密函数 hashbytes 用法简介
转自:http://www.maomao365.com/?p=4732 一.mssql sql hashbytes 函数简介 hashbytes函数功能为:返回一个字符,通过 MD2.MD4.MD5. ...
- php函数long2ip与ip2long()
long2ip - Converts an long integer address into a string in (IPv4) Internet standard dotted format s ...
- 【PAT】B1008 数组元素循环右移问题
猥琐方法 直接分成两部分输出数组元素,注意空格的问题 #include<stdio.h> int arr[101]; void Priarr(int a,int b){ if(a<= ...