3

Problem!

I am calling a JS function inside the html's body section, the function's parameters are gathered by parsing the EL inside the function.

Eg:

<script type="text/javascript">
    jQuery(window).load(function() {
        loadImage("${expression_language_var_1}", "${expression_language_var2}");
    });
</script>

But it seems that sometimes both parameters are cached and I do receive old information.

Questions!

  • Are the script tags inside the html structure being cached just the same way as the external javascript files that are included in the header?

Best Regards,

2
  • 2
    No. But HTML page itself can be cached and of course embeded script tag will be too. Commented Nov 24, 2014 at 16:22
  • @dfsq: Is there anyway that I can ensure the caching won't be happening, at least for that particular js function calling? Commented Nov 25, 2014 at 20:28

1 Answer 1

1

The issue is that the entire HTML page is being cached, including the script tags which contain your evaluated EL. If you serve the page with the following header tags the browser shouldn't cache it:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

For more details about how these headers disable caching refer to this answer: Using <meta> tags to turn off caching in all browsers?

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.