joomla- How to remove unwanted js files from page

前端 未结 4 911
暖寄归人
暖寄归人 2020-12-15 23:08

joomla- How to remove unwanted js files from page

I have used plugins some pages so many js files are included in all pages

4条回答
  •  天涯浪人
    2020-12-15 23:46

    There are two ways that I am aware of:

    1) get an instance if the document object and remove the js files (you could do that in a plugin) :

    getHeadData();
             $scripts = $headData['scripts'];
    
             //remove your script, i.e. mootools
             unset($scripts['/media/system/js/mootools-core.js']);
             unset($scripts['/media/system/js/mootools-more.js']);
             $headData['scripts'] = $scripts;
             $document->setHeadData($headData);
    ?>
    

    2) remove js files directly from your templates index.php :

    _scripts['/media/system/js/mootools-core.js']); ?>
    

提交回复
热议问题