1

私はjavascriptライブラリ(内部にあります<head>)をインポートするウェブサイトを構築しています:

<script type="text/javascript" src="@routes.Assets.at("nicedit/nicEdit.js")"></script>

つまり、
(私のWebサイトのどのページに関係なく)すべてのページが読み込まれると、この行が存在します。

最近のブラウザがライブラリを一度ダウンロードしてからキャッシュするのか、それともすべてのページが読み込まれるのかを知りたいと思いまし
た。javascriptはライブラリに再ダウンロードされます。

ありがとう

4

2 に答える 2

2

Under normal circumstances most browsers will cache a javascript file if it is repeatedly requested from the same url; however, my definition of normal circumstances is wrapped up in how servers are usually set up. The real result depends on what cache headers the server is sending, as well as whether or not the URL changes (which is not clear from your question).

There are lots of questions on StackOverflow about caching JavaScript. This one includes something of a compendium.

于 2012-08-30T12:57:35.563 に答える
1

Please try configuring http.cacheControl

http.cacheControl

HTTP Response headers control for static files: sets the default max-age in seconds, telling the user’s browser how long it should cache the page. This is only read in prod mode, in dev mode the cache is disabled. For example, to send no-cache:

http.cacheControl=0 Default: 3600 - set cache expiry to one hour.

Source of the information.

于 2012-08-30T13:13:03.293 に答える