prevent .js caching?

More
5 years 3 months ago #75132 by mmirasol
mmirasol created the topic: prevent .js caching?
Hello,

Is it possible to prevent .js caching when testing surveys? I'm currently working on a survey using template.js to do custom programming for my questions and I observed that if I put

$('div.'+qcode).hide(); it hides the question initially,

Then, I commented this line to see my values in my hidden question and later uncommented it to rehide the question but it didn't hide the question anymore.

Please advise. Thanks.

Please Log in to join the conversation.

More
5 years 3 months ago #75149 by DenisChenu
DenisChenu replied the topic: prevent .js caching?
Yep,

You need to reload the HTML with F5 (with FF). But js cache can't be manipulated with LS I think, it's difficult to do.

I think you can put some cache config in the apache configuration.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 3 months ago #75156 by tpartner
tpartner replied the topic: prevent .js caching?
I think this is a matter of browser caching, not anything to do with LimeSurvey.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 3 months ago #75159 by Ben_V
Ben_V replied the topic: prevent .js caching?

I think you can put some cache config in the apache configuration.

Ej. in .htaccess file:
<filesMatch "\.(js|css)$">
<ifModule mod_headers.c>
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
</ifModule>
</filesMatch>
</FilesMatch>

If doesn't work because mod_headers not available try:
<FilesMatch "\.(js|css)$">
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
5 years 3 months ago - 5 years 3 months ago #75189 by mmirasol
mmirasol replied the topic: prevent .js caching?
Thank you, benitov, tpartner and Shnoulle. =)

I've tried reloading the browser, clearing the cache (using FF), putting this in my .htaccess file.

<filesMatch "\.(js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>

Still no luck though. At the moment, I had to manually set display:none for each question thru css. Any other ideas?

I really don't understand why the same code works when I run it on firebug, but doesn't work when I put it in my template.js file.
Last Edit: 5 years 3 months ago by mmirasol.

Please Log in to join the conversation.

More
5 years 3 months ago #75208 by Mazi
Mazi replied the topic: prevent .js caching?
I guess this is still a browser caching issue. Maybe at some browsers - perhaps with some add-ons - you can specify files which should not be cached?
I simply use F5 to reload a page in Firefox and it works fine, the browser grabs the new version of the file instead of taking the cached one.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago - 5 years 3 months ago #75323 by mmirasol
mmirasol replied the topic: prevent .js caching?
Perhaps. But I probably did everything to get rid and prevent caching and I do F5 all the time so I think I must have missed something in my code or there's a conflict somewhere. Still, a big thank you to everyone. =)
Last Edit: 5 years 3 months ago by mmirasol.

Please Log in to join the conversation.

More
5 years 3 months ago #75486 by Mazi
Mazi replied the topic: prevent .js caching?
You're welcome!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now