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

The process of building and configuring the Git environment in Docker

Configure Git environment in Docker At work, I en...

Complete steps to use mock.js in Vue project

Using mock.js in Vue project Development tool sel...

How to insert pictures into HTML pages and add map index examples

1. Image formats supported on the WEB: GIF: can s...

How to create a table by month in MySQL stored procedure

Without going into details, let's go straight...

Introduction to /etc/my.cnf parameters in MySQL 5.7

Below are some common parameters of /etc/my.cnf o...

Detailed steps for Linux account file control management

In the Linux system, in addition to various accou...

JavaScript Basics: Error Capture Mechanism

Table of contents Preface Error Object throw try…...

Summary of some tips for bypassing nodejs code execution

Table of contents 1. child_process 2. Command exe...

Detailed explanation of HTML page header code example

Knowledge point 1: Set the base URL of the web pa...

How to implement the Vue mouse wheel scrolling switching routing effect

A root routing component (the root routing compon...

Implementation of Docker deployment of Nuxt.js project

Docker official documentation: https://docs.docke...

Analysis of the Principle of MySQL Index Length Limit

This article mainly introduces the analysis of th...

How to install mysql5.7 in windows

First download the compressed version of mysql, t...

Tutorial on installing MySQL 8.0.11 under Linux

1. Go to the official website to download the ins...