Prevent Chrome to cache JS file

147 Views Asked by At

When I'm connected too long in my back office and tried to log in again I'm rejected so I should clear my browser (Chrome,FF,Edge) every time to get access .

So i noticed that when the file named login.js is load from disk cache I can't access. here is a video that explain the issue.

I'm using PS on 3 websites with different version 1.7.6.5 and 1.7.6.6 aldo 1.7.6.7 on a VPS Linux Centos and 7.1 php version and I don't use any cache module as Nginx or Memcached.

Even on the mobile I should switch to desktop version or clear files to get access .

How can I prevent chrome to cache this file login.js on the browser setting or from the php file

Regards

https://www.prestashop.com/forums/uploads/monthly_2020_07/2020-07-28_05-41-14.mp4.f2a7a6c6fa765bb12f2c4a4d56d0d508.mp4

1

There are 1 best solutions below

0
On
<script src="script.js?v=1"></script>

Change v value when you need (v=1, v=2...)

Or use PHP

<script src="script.js?v=<?php echo(rand(10,100)); ?>"></script>