作者:1471446448_9c38cc | 来源:互联网 | 2023-05-18 04:18
IamtryingtoopennewtabviaJavascriptusingwindow.open(),thenusingwindow.close()toclose,
I am trying to open new tab via Javascript
using window.open()
, then using window.close()
to close, but it seems window.close()
doesn't work in safari( iOS 8 GM seed). Here is the code:
我正在尝试使用windows .open()通过Javascript打开新的选项卡,然后使用windows .close()关闭,但windows .close()在safari(iOS 8 GM seed)中似乎不工作。这是代码:
A.html:
A.html:
Open B
<按钮Onclick= " window.open(' b.html。');返回错误;"> 开放B > 按钮
B.html:
B.html:
Close
<按钮Onclick= " window.close();"> 按钮>关闭
I tried several ways like: setTimeout , window.open()
then close, but doesn't help.
我尝试了几种方法:setTimeout、window.open()然后关闭,但没有帮助。
Is there any workaround for this situation?
在这种情况下有什么办法吗?
1 个解决方案