There are many methods to refresh the page in js, such as reload (), loaction, location. href, which can achieve the page refresh effect. Let's take a look at these methods.
It is usually used in web development. There are more than one method. How many methods have you mastered?
Common
Php method to prevent malicious page refresh
In general, malicious refresh is constantly to refresh the submission page, resulting in a large number of invalid data, below we summarize the PHP prevent malicious Refresh
Local refresh of the login is on a page to have a login box, log in to the background to the asynchronous processing, processing completed will be displayed on the front end of the login user information, the most common example is the login Youku when we can see the URL login has not changed (in fact, Youku is not the way to local refresh, It is obvious that the
Occasionally, Javascript is used to refresh the page. When the page cannot be refreshed, We will summarize several methods of refreshing the page using Javascript, as shown below:
Window. location. reload () refresh the current page
The syntax for the two methods is introduced first:the reload method, which forces the browser to refresh the current page. Syntax: Location.reload ([Bforceget]) Parameters: Bforceget, optional parameter, default is False, the current page is taken from the client cache. True, the latest page from the server is taken
Submit the form. when the parent page is refreshed, the old pop-up dialog box is displayed on the parent page. php click a link to B. php modifies data B. submit data after php modification.. php refreshes the page at the same time. Each time you refresh the page, a dialog b
There are a lot of ways. The more commonly used is the IFRAME to do so. Now you have Ajax, so it's usually Ajax.The first method, AJAX implementation:Of course, the use of Ajax is really very simple can be achieved, but there is a lot of knowledge is somewhat deep. I used to do page time automatic refresh function is the use of Ajax. The complete code is:1.gettime.php:
Copy Code code as follows:
Usage scenarios:1. The page needs to be refreshed periodically, loading the data in real time (WebSocket and SSE in H5 can be partially refreshed)2. Jump to the specified page after a certain time (login registration, etc.)3. Front-end development use pseudo-data to debug HTML pages (modify some JS variable values, you can automatically refresh the effect)Example
How to solve the Ajax page refresh Problem
The problem frequently encountered in Ajax applications is Refresh: After a page is partially updated, the user refresh the entire page and the page
This article mainly introduces php's use of session to prevent repeated page refreshes. if you need it, you can refer to how to prevent repeated page refreshes, in the php environment, session can be easily implemented.
B. php code
The code is very simple. it is nothing more than to write the ip address and the data submitted to the anti-refresh
One: JS overloaded page, local refresh, back to the previous page
Copy Code code as follows:
Return the first two pages and refresh the JS code should be how to write.
Copy Code code as follows:
History.go (-2);
Location.reload ();
Two: Js method
Copy Code code
The framework of the refresh has always been uncertain, now think of this problem, the solution is really quite a lot, here summed up the 7 ways to refresh the frame with JS, in any of the frames page to refresh the other frames page, or more practical, these 7 methods are:
This article describes in detail how to use js to refresh the current page retention parameters. Below is a good implementation, you can see that after the website has a certain amount of traffic, you need to find a way to improve the website's stickiness. The world's buyer network recently plans to get a set of foreign trade tools, which are commonly used tools, such as World Time query. Among them, there
In the script home to see an article, I think it may be used later, but can not be collected, so it can only be transferred to the blog park. The following is the original address: http://www.jb51.net/article/87856.htm This article mainly introduces the Ajax fallback Refresh page problem solution of the relevant information, very good, with reference value, interested friends learn togetherIntroduction to A
The web page is automatically refreshed, without generating a click solution. The web page is automatically refreshed without generating a click solution without using XMLHTTP. In fact, it is also very strange. I don't know how Microsoft handles it. I will refresh it regularly and change it to another way. Share the post with you.
Do not use the
In PHP, how can I prevent repeated page refresh? thank you. in PHP, how does one disable repeated page refresh. if you cannot repeat F5 and refresh button ------ solution ------------------ There are four methods: 1. Use JAVASCRIPT to Judge 2. The session is limited to 3. Ho
How to use js to refresh the verification code page (made in php) I want to click [cannot see] on the login page to refresh the random code: lt; imgsrc = quot; checkcode. php quot; gt; lt; a gt; cannot see clearly lt;/a gt; nbsp; where checkcode. php is a random code page
When you do a project, you need to implement one of these features: A window is popped, the window is operated, the window is closed after the operation is completed, and the parent window is refreshed; tangle for a little while. Check the data, and then their own practice, success, the following will I find the information to share it;
With IFRAME, pop-up page refresh the parent
1. Let's look at a simple example: the following names the three pagesFrame.html,Top.html,Bottom.htmlFor example, describe how to do this.Frame.html consists of two pages (bottom (bottom.html) under the top (top.html#). The Code is as follows:1 Now, let's assume that top.html (the page above) has seven buttoners to refresh bottom.html (the page below). You can us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.