Raziza O
Raziza O

Reputation: 1646

Force reload after new version in DOJO

I am providing an infrastructure that require the developer to include only one simple java script file that then includes allot others, for instance DOJO toolkit. Later DOJO is loading all\some of my infrastructure files.

When i'm updating the version i'm simply telling my clients to include the version number in the <script src="...?ver=1.2"> so it will not take the files from the cache.

My problem is that (this simple file is being reloaded but) the rest of my files that being loaded by DOJO are still being loaded from the cache.

Is there a way to do the same technick, or maybe other way, to force my browser take the files from the server at this time, and not from the cache ?

Upvotes: 1

Views: 944

Answers (1)

Raziza O
Raziza O

Reputation: 1646

As usual, I am posting question and answering myself. But sharing the answer so it will use others and not deleting the post.

Using dojoConfig property cacheBust is the solution.

dojoConfig = {
    ...
    cacheBust="v=1.2.3",
    ...
}

In DOJO documentation it's stated that when you send true it will add the time as query string. Which means that every load will be from the server and never from the cache. but what we can do is adding constant string as i wrote above v=1.2.3 and this string will be added as the query string as well, and giving us more power on when the version will be loaded from cache or server

Upvotes: 4

Related Questions