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 explanation of the lock structure in MySQL

Mysql supports 3 types of lock structures Table-l...

Super detailed tutorial to implement Vue bottom navigation bar TabBar

Table of contents Project Introduction: Project D...

Tutorial on building nextcloud personal network disk with Docker

Table of contents 1. Introduction 2. Deployment E...

Use render function to encapsulate highly scalable components

need: In background management, there are often d...

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

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

Detailed process of installing nginx1.9.1 on centos8

1.17.9 More delicious, really Nginx download addr...

A brief talk about JavaScript parasitic composition inheritance

Composition inheritance Combination inheritance i...

MySQL Series 14 MySQL High Availability Implementation

1. MHA ​By monitoring the master node, automatic ...

Summary of ten principles for optimizing basic statements in MySQL

Preface In the application of database, programme...

How to customize at and cron scheduled tasks in Linux

There are two types of scheduled tasks in Linux s...

Details on macrotasks and microtasks in JavaScript

Table of contents 1. What are microtasks? 2. What...

How to use vue3 to build a material library

Table of contents Why do we need a material libra...

Detailed tutorial on running multiple Springboot with Docker

Docker runs multiple Springboot First: Port mappi...

Detailed explanation on how to install MySQL database on Alibaba Cloud Server

Preface Since I needed to install Zookeeper durin...