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

Discussion on Web Imitation and Plagiarism

A few months after entering the industry in 2005, ...

Install and configure ssh in CentOS7

1. Install openssh-server yum install -y openssl ...

MySQL knowledge points for the second-level computer exam mysql alter command

Usage of alter command in mysql to edit table str...

A detailed introduction to wget command in Linux

Table of contents First install wget View Help Ma...

Detailed explanation of MySQL instance with SSD storage enabled

Detailed explanation of MySQL instance with SSD s...

How to implement JavaScript output of Fibonacci sequence

Table of contents topic analyze Basic solution Ba...

Linux remote control windows system program (three methods)

Sometimes we need to remotely run programs on the...

How to draw special graphics in CSS

1. Triangle Border settings Code: width: 300px; h...

ffmpeg Chinese parameter description and usage examples

1. When ffmpeg pushes video files, the encoding f...

A brief analysis of different ways to configure static IP addresses in RHEL8

While working on a Linux server, assigning static...

Steps to create a WEBSERVER using NODE.JS

Table of contents What is nodejs Install NodeJS H...

Detailed explanation of how to quickly build a blog website using Docker

Table of contents 1. Preparation 2. Deployment Pr...

How to use Node.js to determine whether a png image has transparent pixels

background PNG images take up more storage space ...

Detailed explanation of the implementation of nginx process lock

Table of contents 1. The role of nginx process lo...

Layim in javascript to find friends and groups

Currently, layui officials have not provided the ...