defer js files

onne
onne
Offline
0
Hi Germi,

I'd like to test if deferrign the some scripts from your component will affect how my site loads but i'm not sure how to...

I'd like to add 'defer' to the js codes from

plugins/muscolplayers/jwplayer/jwplayer/jwplayer.js (167.9KiB)
plugins/content/hwdjwplayer/assets/jwplayer7/jwplayer.js (151.8KiB)

But where are these loaded? I'm looking for the code but dont know which file they are in
Responses (5)
  • Accepted Answer

    Monday, March 27 2017, 10:02 AM - #Permalink
    0
    this indicates how: https://api.joomla.org/cms-3/classes/jdocument.html#method_addscript

    you have to find at the end:
    $document->addScript($jwplayer_root.'jwplayer.js');


    and change it for

    $document->addScript($jwplayer_root.'jwplayer.js', 'text/javascript', true, true);


    or whatever you need.
    The reply is currently minimized Show
  • Accepted Answer

    onne
    onne
    Offline
    Saturday, March 25 2017, 08:22 PM - #Permalink
    0
    ok...and could you tell me where/how i should add "type="text/javascript" defer="defer" async="async"....
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, March 25 2017, 06:19 PM - #Permalink
    0
    here: plugins/muscolplayers/jwplayer/jwplayer.php
    The reply is currently minimized Show
  • Accepted Answer

    onne
    onne
    Offline
    Saturday, March 25 2017, 04:29 PM - #Permalink
    0
    Hi Germi,

    Back on this old one as i'd really like to test this. Thing is that my 'defer' plugin for some reason does not catch the paths mentioned above.

    Can i manually add the defer to the called path somewhere? I dont know in which file to look?
    The reply is currently minimized Show
  • Accepted Answer

    Monday, November 07 2016, 09:00 AM - #Permalink
    0
    they could affect because things are loaded asynchronally.. better not defer those.

    Onne, please consider renewing your subscription, which expired a month ago..

    thanks
    The reply is currently minimized Show
Your Reply