[英]website update clear cache on all client side devices so img and content update
我是初學者 web 開發人員,我需要幫助,因為我的 web 頁面 img 更新不會在客戶端設備上自動刷新。 我嘗試將?v=1 添加到img src 和css。 不工作。 嘗試在 css 中完全托管 img url。 不更新。 有沒有辦法清除 pc 和移動設備緩存,以便在添加內容和更改背景 img 時我的頁面隨處更新。
head...
<!--custom stylesheet-->
<link rel="stylesheet" type="text/css" href="css/style.css?v=1">
<link rel="stylesheet" type="text/css" href="css/main.css?v=1" />
body...
<img src="img/logo.webp?v=1" alt="logo" />
stylesheet...
background: url(../img/landing/body2.webp?v=1);
我想通了,我正在編輯 img 文件並保存為原始文件名。 這導致客戶端圖像出現問題。 所以我重命名了我的img並添加了一個日期時間戳作為?v =(當前日期)。 我將日期時間戳添加到 img、url、src 在 html 主體和頭部 css 以及我編輯的任何地方。
head...
<!--custom stylesheet-->
<link rel="stylesheet" type="text/css" href="css/style.css?v=30Jun2020125632">
<link rel="stylesheet" type="text/css" href="css/main.css?v=30Jun2020125632" />
body...
<img src="img/logos.webp?v=30Jun2020125632" alt="logo" />
stylesheet...
background: url(../img/landing/body2.webp?v=30Jun2020125632);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.