After our magento 2 site is live whenever we are doing changes in JS file it doesn't reflect in customer browser as a result some of the pages breaks for those customer who doesn't flush his browser cache. Is there any way that browser will load fresh file from the server if there is any changes in the file.

Thanks in Advance I am facing this issue in magento 2

  • You have tried versioning? mage2.pro/t/topic/3476 – Rizwan Khan Jun 28 '19 at 12:02
  • We can't add versioning in production site – anjanbarik Jun 28 '19 at 12:06
  • You want to refresh only one javascript file when your js changes? – Rizwan Khan Jun 28 '19 at 12:09
  • Anything will work. – anjanbarik Jun 28 '19 at 12:19

You can add a query string to your javascript file URL in order to take effect in your customer browsers. like below example.


Change your version when you make changes in your js file.

  • How you can do that in magento 2? – anjanbarik Jul 1 '19 at 7:39
  • which js you want to take effect? is it magento default or your custom. – Rizwan Khan Jul 1 '19 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.