Morgan Ng Morgan Ng - 1 year ago 75
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>"

Answer Source

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>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download