How do I redirect to the current page using JavaScript?

Example using a button:

<input type="button" value="Reload Page" onClick="window.location.reload()">

See here:

http://www.mediacollege.com/internet/javascript/page/reload.html


Redirecting to the current URL is the same as redirecting to any url:

// Same as clicking on a link
window.location.href = window.location.href;

// Same as HTTP redirecting
window.location.replace(window.location.href);

Assuming you mean the link should refresh the current page, you can use window.location.reload(). In jQuery it would look like this:

<a href="#" id="myLink">Refresh current page</a>
$("#myLink").click(function() {
    window.location.reload();
});

In plain JS it would look like this:

document.querySelector("#myLink").addEventListener('click', function() {
    window.location.reload();
});