【发布时间】:2016-08-20 00:46:18
【问题描述】:
<script type="text/javascript" src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript">
window.close();
</script>
此代码在 Chrome 和 Fireworks 中无效,但在 IE 中有效。出了什么问题?我用我朋友的 Chrome 试了一下,效果很好。
【问题讨论】:
-
你是从JS端打开这个窗口吗?
-
只有用JS打开的窗口才能用JS关闭。例如,如果您尝试使用 Chrome 控制台关闭窗口,则会收到
Scripts may close only the windows that were opened by it.
标签: javascript