How does js refresh the current page once?
This article is a detailed introduction to "how js refreshes the current page once". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "how js refreshes the current page once" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of Xiaobian.
Method 1: Assign the address of the current page to the variable url
function reurl() { url = location.href; //Assign the address of the current page to the variable url var times = url.split("? "); //split variable url separator is"? " if (times[1] != 1){ //if} After the value is not equal to 1 means there is no refresh url += "? 1"; //add the value of url variable? 1 self.location.replace(url); //Refresh page }}
Method 2: Use the reload method to force the browser to refresh the current page once.
$(document).ready(function () { if(location.href.indexOf("#reloaded")==-1){ location.href=location.href+"#reloaded"; location.reload(); }}) Read here, this article "js how to refresh the current page once" article has been introduced, want to master the knowledge points of this article also need to be used by yourself to understand, if you want to know more related content of the article, welcome to pay attention to the industry information channel.