1

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.

1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.