0

I can easily make the browser always request the latest version of a page by appending a timestamp to the query string, for example:

onclick="window.open('index.html?t=12343542436')"

Is there a way that I could do that without messing with the url? (Which is ugly from a UI point of view--makes sharing links harder)

4

1 に答える 1

2

サーバーを設定して、キャッシュ コントロールの HTTP ヘッダーと.htmlファイル タイプを送信します。

たとえば、Apache では次のようになります。

<IfModule mod_expires.c>
  ExpiresByType text/html     "access plus 0 seconds"
</IfModule>

すべてのサーバーに同様の構成があります (PHP や Node.js などのプログラミング言語にも)

キャッシュ関連の HTTP ヘッダーについて詳しく説明している記事: http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/

于 2013-09-19T19:51:34.257 に答える