Adding an external JS file in Magento 2 is very easy indeed.

In your layout file:

    <link src="" src_type="url" />

The src_type is the clever bit that tells Magento this is an external URL.

Currently this technique is only available in the head section of your layout file. This is something to bare in mind as this will cause the browser to render block whilst the file is downloaded.

Lovely job.

  • magento2
  • javascript

Like this post? Share it :)

Related Posts