Jump to content
thirty bees forum
  • 0

How does Javascript gets sent to header when it is third party


movieseals

Question

When I look at the source for my front page, I see a download for this:

https://unpkg.com/sweetalert/dist/sweetalert.min.js

unpkg is a CDN, and apparently things changed, so this link instead redirects: 

FROM: https://unpkg.com/sweetalert/dist/sweetalert.min.js TO: 302

And then it loads the new script from the new location, which is:

/[email protected]/dist/sweetalert.min.js...  Which takes a lot of time for nothing.

Not sure if this comes from the theme or TB, but I need to find where this information is sent to the header of the theme, as in the header, all I can see is:

{if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
    {$js_def}
    {foreach from=$js_files item=js_uri}
        <script type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}" defer></script>
    {/foreach}
{/if}
 

My question is: How do I find which files sends the JS information to the header so that I can correct the link with the proper new destination OR remove it altogether if it is no longer useful?

Any help is appreciated.

C.

Edited by movieseals
Addition
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

This will be in some module. Most likely in hookHeader function. Look for code like this

$controller->addJS('https://unpkg.com/sweetalert/dist/sweetalert.min.js');

Context::getContext()->controller->addJS('https://unpkg.com/sweetalert/dist/sweetalert.min.js');

$this->context->controller->addJS('https://unpkg.com/sweetalert/dist/sweetalert.min.js');

If you have ssh access to your server, you can use find/grep to quickly find the code. If you have only ftp access, you will have to check every module one by one.

  • Like 1
Link to comment
Share on other sites

  • 0
On 11/11/2023 at 2:41 AM, datakick said:

If you have only ftp access, you will have to check every module one by one.

Download the entire site and use the search function. Codelobster, or any other editor should give you that option 😉

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...