在同一窗口和同一选项卡中注销URL

时间:2016-08-27 01:59:13

标签: javascript jquery html

我想在同一窗口和包含带链接的页面的同一标签中注销链接。

当我尝试使用window.open单击注销链接时,它会在新选项卡中打开 - 不在同一窗口的同一选项卡中,除非我刷新页面,否则当前页面不会注销。

代码:

+"<button class=\"withdraw\" onclick=\"window.open(\'/index/LogOut.html\')\">Logout</button>"

1 个答案:

答案 0 :(得分:0)

您可以设置window.open属性,而不是使用window.location.href,该属性会警告当前窗口导航到指定的网址。

e.g。

<button class="withdraw" onclick="window.location.href='/index/LogOut.html'">Logout</button>

相关问题