0

In magento 1 in xml

<script src="http://www.abc/aa/abc.js"></script>

In magento 2 i am trying to ad like this in my xml but its not adding how can i add js using link without download and save it. I want this js only in my custom page

0

The easiest way is to do it through the admin area.

Go to Stores > Configuration > Design and then in the HTML Head tab you can add miscellaneous scripts there. eg.

<script  type="text/javascript" src="http://www.google-analytics.com/analytics.js"></script> 

Hope it will help you.

0

You can achieve this using template call

<referenceContainer name="content">
        <block class="\Magento\Framework\View\Element\Template" template="Namespace_Modulename::before.phtml" name="before_body_js"/>
</referenceContainer>

add template file before.phtml add below code

 <script src="http://www.abc/aa/abc.js" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.