Jump to content

Safe to move scripts.min.js javascript to footer from HEAD?

Recommended Posts

I'm on WHMCS 7.5.1. I noticed that the site places a single, minified js file, scripts.min.js, in its header:

<script type="text/javascript">
    var csrfToken = '{$token}',
        markdownGuide = '{lang key="markdown.title"}',
        locale = '{if !empty($mdeLocale)}{$mdeLocale}{else}en{/if}',
        saved = '{lang key="markdown.saved"}',
        saving = '{lang key="markdown.saving"}',
        whmcsBaseUrl = "{\WHMCS\Utility\Environment\WebHelper::getBaseUrl()}";
<script src="{$WEB_ROOT}/templates/{$template}/js/scripts.min.js?v={$versionHash}"></script>

I'm just wondering if it's safe to move this section to the footer so it does not "render block"? Just tried it on a site under development and seems fine so far at first glance. I wonder if others did the same and if this can potentially cause some issues for WHMCS.


Link to comment
Share on other sites

Never mind, all the data table lists (invoice list etc) inside the client area broke. Was worth a try though!

Really wish WHMCS could optimize their code to defer loading of js and css, especially now that they have down to only few scripts .

I also noticed that on some pages like the  table lists WHMCS places several additional js and css in the middle of <body> (not a good practice).  Maybe those depended on the main .js in the HEAD.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated