Welcome, Guest
Username: Password: Remember me

TOPIC: prevent .js caching?

prevent .js caching? 2 years 4 months ago #75132

  • mmirasol
  • mmirasol's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Karma: 0
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.
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75149

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6198
  • Thank you received: 787
  • Karma: 238
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
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75156

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4050
  • Thank you received: 740
  • Karma: 341
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75159

  • Ben_V
  • Ben_V's Avatar
  • OFFLINE
  • Platinum Lime
  • Posts: 1061
  • Thank you received: 234
  • Karma: 74
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

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75189

  • mmirasol
  • mmirasol's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Karma: 0
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: 2 years 4 months ago by mmirasol.
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75208

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5300
  • Thank you received: 291
  • Karma: 247
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)limesurvey.org'"
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75323

  • mmirasol
  • mmirasol's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Karma: 0
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: 2 years 4 months ago by mmirasol.
The administrator has disabled public write access.

Re: prevent .js caching? 2 years 4 months ago #75486

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5300
  • Thank you received: 291
  • Karma: 247
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)limesurvey.org'"
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.285 seconds
Donation Image