cancel
Showing results for 
Search instead for 
Did you mean: 

include 3rd party js

SOLVED

include 3rd party js

Hi,

using 2.2.2 in developer mode. I've put this inside the <head> tag of default_head_blocks.xml:

<script src="js/query.matchHeight.js" />

and ofc I did put the file inside the web/js folder of my child theme, but the page tells me cannot find the file. I also forced a deploy static content with no luck.

What am I missing?

Thanks a lot

2 REPLIES

Re: include 3rd party js

If you want to add js in head tag of layout file then try below code :

 

<head>
        <link src="js/query.matchHeight.js"/> 
</head>

 

Then run bin/magento setup:static-content:deploy command it will works.

 

if issue solved,Click Kudos & Accept as Solution

Re: include 3rd party js

Keep your js file inside app/design/frontend/{Vendorname}/{themename}/web/js/query.matchHeight.js

 

You can use any script or link tag to show your js.

create file default_head_blocks.xml file in your theme,

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="js/query.matchHeight.js"/>
        <!-- <link src="js/query.matchHeight.js"/> -->
    </head>
    <body />
</page>

Run comand,

php bin/magento setup:static-content:deploy -f
If Issue Solved, Click Kudos/Accept As solutions.