关于javascript:locationhash导致windowclose失效

4次阅读

共计 187 个字符,预计需要花费 1 分钟才能阅读完成。

通常用 <a target="_blank"></a> 或 window.open() 关上的新窗口能够用 window.close() 办法敞开, 但当新窗口中调用了 location.hash 时 (如: react-router 的 hashHistory), 则 window.close() 办法会生效.

解决方案:
绕开 location.hash 办法, 应用 browserHistory 或其余路由形式.

正文完
 0