0

How to Remove after question mark data in JS File?

Our JS File was - /media/jui/js/jquery.min.js?74a9f5d23561aa584c363ede5bfbfad6

For Example - Only load in /media/jui/js/jquery.min.js

3
  • Any particular reason why you'd want to do that?
    – Lodder
    Commented Jul 14, 2021 at 8:05
  • @Lodder I have combined on JS file and daily to changes on the file name. Commented Jul 14, 2021 at 8:37
  • Thank you for bringing your question over from Stack Overflow. Please take our tour now that you are here. Commented Jul 14, 2021 at 23:32

1 Answer 1

1

The "question mark data" = token that prevents caching issues after Joomla updates.

When you update Joomla to a higher version, its CSS and/or JavaScript can be changed. Visitors that visited your website before will load it from their cache and not the new files from the site.

If you really don't want that, you could change the 'version' => 'auto' part when the Javascript file is loaded.

For instance in the default Protostar: JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));

The 'auto' adds the token. You can change it to an empty ''.

4
  • @renish Please do not post duplicate questions. If there is something about pe7er's advice which you don't understand or it is not resolving your question in the way that you wish, please type a comment under the answer so that pe7er can try to offer additional help. Commented Jul 17, 2021 at 2:39
  • @pe7er Thanks, It was Remove after Questions Mark Data. - screencast.com/t/MZlYynVY7 But Our JS file display in comment sections. 2) How to Remove Bydefault "jquery.min.js" in our Joomla? Commented Jul 19, 2021 at 7:38
  • @pe7er I have changes on File Name But It was not displaying - JHtml::_('script', 'jquery.min.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9')); Commented Jul 19, 2021 at 7:47
  • You can load CSS/JS via your template, via a component, module or plugin. You've to find out where the JS is loaded first. Furthermore there are many ways to load a CSS/JS file in Joomla. You can hard code the URL in the head of the template (not recommended!) or use a Joomla function like JHtml (or its modern HTMLHelper) to load it into the header.
    – pe7er
    Commented Jul 19, 2021 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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