Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does js refresh the current page once?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report