Sara Ree
Sara Ree

Reputation: 3543

add a version to script tag prevents it to be cached

I have a script tag like this:

<script src="/dashboard/js/script.js?version=1"></script>

But for some reason it never cache, it always being downloaded !

I thought it should download first and after this, as long as it's the version=1 it should be cached , right ?

What I'm missing ? How can I cache version 1 script to the browser cache ?

Upvotes: 0

Views: 462

Answers (1)

Gergo
Gergo

Reputation: 135

are you checking the status code or also the extended information?

On following screenshots it looks like it is cached but still returns response 200

Check the timing waterfall. It will provide additional info.

timing waterfall1 timing waterfall2

screenshot1

screenshot2

Upvotes: 1

Related Questions