[英]Simply opening only one tab at window.open
For example, my html
file: 例如,我的
html
文件:
<script>
window.open('http://stackoverflow.com/');
</script>
I run my file . 我运行我的文件 。 I want that only Stack Overflow tab opened.
我只希望打开“ 堆栈溢出”选项卡。 I don't want that tab before the Stack Overflow tab opened.
在堆栈溢出选项卡打开之前,我不希望该选项卡。 What do I have to make?
我要做什么? Without use the server.
不使用服务器。
使用window.location.href加载当前选项卡。
window.location.href='http://stackoverflow.com';
This obviously happens because the window which runs your script isn't closed after the script is run. 这显然是因为运行脚本后未关闭运行脚本的窗口。 Then you should close the window.
然后,您应该关闭窗口。
<script>
window.open('http://stackoverflow.com/');
window.close();
</script>
您可以在加载函数中使用window.location.href="http://stackoverflow.com/"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.