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 routes configuration of Vue-Router

Table of contents introduce Object attributes in ...

Windows DNS server exposed "worm-level" vulnerability, has existed for 17 years

Vulnerability Introduction The SigRed vulnerabili...

WeChat applet implements countdown for sending SMS verification code

This article shares the specific code for the WeC...

JavaScript to implement login form

This article example shares the specific code of ...

Tutorial on installing jdk1.8 on ubuntu14.04

1. Download jdk download address我下載的是jdk-8u221-li...

Summary and analysis of commonly used Docker commands and examples

Table of contents 1. Container lifecycle manageme...

Solution to the problem of repeated triggering of functions in Vue project watch

Table of contents Problem description: Solution 1...

Vue realizes the palace grid rotation lottery

Vue implements the palace grid rotation lottery (...

How to migrate the data directory in Docker

Table of contents View Disk Usage Disk Cleanup (D...

Detailed deployment of Alibaba Cloud Server (graphic tutorial)

I have recently learned web development front-end...

MySQL 8.0.15 installation and configuration graphic tutorial under Win10

This article records the installation and configu...

How to use translate and transition in CSS3

I always feel that translate and transition are v...

Div exceeds hidden text and hides the CSS code beyond the div part

Before hiding: After hiding: CSS: Copy code The co...