+ Reply to Thread
Results 1 to 7 of 7

Thread: defer calls to javascript files

  1. #1

    defer calls to javascript files

    Hi flynax experts,

    I am trying to improve my site's speed and Google analyser recomends to defer the call to these 2 java scripts:

    <script type="text/javascript" src="../plugins/reportBrokenListing/static/lib.js"></script><script type="text/javascript" src=".../libs/jquery/jquery.textareaCounter.js"></script>

    Does anyone know which file i need to edit to add a "defer" to the <script> calls to these scripts?
    It looks like there are in a file in plugins/verification code folders?
    I checked the main header.tpl file and they are not in there.


    Many thanks
    Chris

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    Hello,

    in version 4.5.2 you can modify javascript code for reportBrokenListing via _hooks table:

    find hook by Name = 'tplHeader' and Plugin = 'reportBrokenListing' and modify its code

  3. #3
    Thank you!

  4. #4
    Member
    Join Date
    Jan 2019
    Location
    uk
    Posts
    47
    please can I have code and placement I'm try to improve page speed now affecting google indexing site

  5. #5
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    Hello,

    See rlReportBrokenListing.class.php > public function hookApTplFooter() from plugins/reportBrokenListing

    replace:
    PHP Code:
    Only registered members can view the code
    with:
    PHP Code:
    Only registered members can view the code
    Last edited by Rudi; May 19, 2021 at 10:44 AM.

  6. #6
    Member
    Join Date
    Jan 2019
    Location
    uk
    Posts
    47
    hi sorry I was talking about this code in head file

    <script src="{$smarty.const.RL_LIBS_URL}jquery/jquery.js"></script>
    <script src="{$smarty.const.RL_LIBS_URL}javascript/system.lib.js"></script>
    is it possible to defer or async these files without breaking site thanks in advance if you can help.

  7. #7
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,138
    You can find them in templates > your_template > tpl > head.tpl

+ Reply to Thread