Morgan Ng Morgan Ng - 1 month ago 5x
HTML Question

Logout URL in same window and in same tab

I want to logout a link in the same window and in the same tab that contains the page with the link.

When I try click logout a link by using, then it opens in new tab—not in the same tab in the same window and the current page will not logout unless i refresh the pages.


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


Instead of using, you can set the window.location.href property which will caues the current window to navigate to the specified URL.


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