Answer the question
In order to leave comments, you need to log in
How not to cache a static page on Bitrix?
Good afternoon.
There is a static page on Bitrix, a css and js script is connected to it.
This page is heavily cached, we make any changes to css or js and do not see the changes.
Tell me, how can I remove the cache immeno to the page or to these 2 scripts?
Thank you.
Answer the question
In order to leave comments, you need to log in
If it is inserts into html code, then the
easiest option is to add a random string to the link to js and css.
Example
<script src="test.js?random=<?php echo uniqid(); ?>"></script>
use Bitrix\Main\Page\Asset;
Asset::getInstance()->addJs(SITE_TEMPLATE_PATH . "/js/fix.js");
Asset::getInstance()->addCss(SITE_TEMPLATE_PATH . "/styles/fix.css");
Asset::getInstance()->addString("<link href='http://fonts.googleapis.com/css?family=PT+Sans:400&subset=cyrillic' rel='stylesheet' type='text/css'>");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question