I searched for asp php on the internet. how can I block the cache of the backend button? I searched for asp php on the internet. how can I block the cache of the backend button?
Reply content:
I searched for asp php on the internet. how can I block the cache of the backend button?
-
Cannot stop browsinghistory.back()And other behaviors
-
You can set the page to non-cache.
$nocache = array( 'Expires' => '0', 'Cache-Control' => 'no-store,private, post-check=0, pre-check=0, max-age=0', 'Pragma' => 'no-cache');foreach($nocache as k => $v) header($k.': '.$v);
-
If you really want to reject the rollback, you can use the following method to simulate and consider performing a jump.Back onceWill automatically jump to the current page, similar to refreshing
header('Location: index.php');
Take the homepage pagination link for example:
3
Search engine crawlers access the service based on href./index.php?page=3It is helpful for SEO to obtain 3rd pages of data.
The user can access/index. php normally by right-clicking in the browser and selecting "open in new tab? Page = 3.
If you click a link on the page, the click event is triggered. JS loads and renders local data through AJAX and sets location. hash/index.php#/page/3.
location.hash = "#/page/3";
The browser can automatically remember the location. hash history. we only need to listen to the location. hash change events.hashchange(IE8 is supported, and IE7/6 is not supported). you can reload the page when you click the return button of the browser.
$ (Window ). on ("hashchange", function () {alert (location. hash); // output #/page/2 var arr = location. hash. split ("/"); // ["#", "page", "2"] if (arr [1] = "page ") {page (arr [2]); // AJAX partial loading of 2nd page data // location. href = "/index. php? Page = "+ arr [2] +" & "+ new Date (). getTime (); // directly access page 2nd }});
The above "SEO and experience-oriented hyperlink design" should be able to meet the requirements of the landlord, but it requires a certain amount of transformation costs.
Page loading complete js refresh page location. href = location. href