Sharing several methods to disable page caching

Sharing several methods to disable page caching

Today, when developing, I encountered a method where the customer requested that the page not be cached. After checking, I found the following methods to prevent the page from being cached:

html
Just add it to the head.

Copy code
The code is as follows:

<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>

asp tutorial practice

Copy code
The code is as follows:

Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"

PHP tutorial practice


Copy code
The code is as follows:

<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d MYH:i:s') . 'GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
?>

There is also a simpler method, which is used by everyone when ajax? mt = random data

<<:  A brief analysis of the principles of NFS servers and the steps for building, configuring and deploying them

>>:  Design sharing of the download page of the Pengyou.com mobile client (picture and text)

Recommend

Detailed tutorial on MySql installation and uninstallation

This article shares the tutorial of MySql install...

jQuery realizes the effect of theater seat selection and reservation

jQuery realizes the effect of theater seat select...

A brief understanding of the three principles of adding MySQL indexes

1. The Importance of Indexes Indexes are used to ...

vue-router hook function implements routing guard

Table of contents Overview Global hook function R...

Chinese and English font name comparison table (including Founder and Arphic)

In CSS files, we often see some font names become...

MySQL uses frm files and ibd files to restore table data

Table of contents Introduction to frm files and i...

JS implements Baidu search box

This article example shares the specific code of ...

Mysql table creation foreign key error solution

Database Table A: CREATE TABLE task_desc_tab ( id...

MySQL performance optimization tips

MySQL Performance Optimization MySQL is widely us...

js to realize the rotation of web page pictures

This article shares the specific code of js to re...

An article teaches you how to use js to achieve the barrage effect

Table of contents Create a new html file: Create ...

Example of using store in vue3 to record scroll position

Table of contents Overall Effect Listen for conta...

How to change the website accessed by http to https in nginx

Table of contents 1. Background 2. Prerequisites ...