window.location.reload();
window.location.reload(true); // Deprecated
// Use this instead
window.location.reload();
// @Zenonymous
//with no cache
document.location.reload(true);
//else
document.location.reload();
/**
* Si le paramètre est nul, recharge la page, sinon recharge la page avec le paramètre.
* If the parameter is null, reload the page, else, reload the page with the parameter
* @param [param=null] - Le paramètre que vous souhaitez ajouter à l'URL.
*/
function reloadPage(param = null){
if ( param != null ){
window.location.href = window.location.href.replace( /[?#].*|$/, `${param}` );
}
else
{
if ( window.location.href.split('?').length > 1 ){
window.location.href = window.location.href.split('?')[0];
}
else
window.location.reload();
}
//param == null ? window.location.reload(): window.location.href = window.location.href.replace( /[?#].*|$/, `${param}` );
}
window.onbeforeunload = function() {
return "Dude, are you sure you want to refresh? Think of the kittens!";
}
location.reload();
// OR
window.location.reload();
// Works on iOS Safari as well
location.reload()
window.location.reload()
window.location.reload(true);
location.reload():
<script type="text/javascript">
function autoRefreshPage()
{
window.location = window.location.href;
}
setInterval('autoRefreshPage()', 10000);
</script>
location.reload();
Works like refresh button.
function refresh(milliseconds) {
console.log("Refreshing");
setTimeout("location.reload(true);", milliseconds);
}
function your_code() {
//code stuff
refresh(1000); //refreshes after 1 second
}
//check for Navigation Timing API support
if (window.performance) {
console.info("window.performance works fine on this browser");
}
console.info(performance.navigation.type);
if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
console.info( "This page is reloaded" );
} else {
console.info( "This page is not reloaded");
}
window.location.href = window.location.pathname + window.location.search + window.location.hash;