Reputation: 1367
I am using the h:outputScript-tag to add javascript-files to the page. The problem I am facing is that the browser is caching the js-files. Usually I would add a parameter to the url of the script-tag, but this doesn't work with h:outputScript.
Is there a way to pass a parameter to the h:outputScript-tag to prevent caching? I don't want to prevent caching for the whole page, but only for certain elements.
Upvotes: 1
Views: 1515
Reputation: 5780
This is a browser-specific problem. Most modern browsers will allow you to disable caching for the sake of testing, however there's no way to disable caching to all users who use your web application. My advice would be to move the script onto the physical page (add script inside h:outputScript tag and remove name attribute). This allows you to potentially create dynamic javascript code and therefore means it must be loaded alongside the page itself each and every time.
However I would only recommend this if there were no other solutions available. Most times a seemingly impossible obstacle can be easily overcome with a little outside-the-box thinking.
Upvotes: 1