1

Can anyone tell me how to add third party js link in magento2.3. I want to add this in my layout.xml file and use in template file.

The resource from “http://127.0.0.1/magento2/pub/static/version1578470158/front_US/https://test.com/scripts/test.js” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff).

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <head>
      <script type="text/javascript" src="https://test.com/scripts/test.js"/>
  </head>
    <referenceContainer name="head.additional">
        <block class="Magento\Framework\View\Element\Template" name="pricespider.tagging.success" template="Devcrew_PriceSpider::success.phtml"/>
    </referenceContainer>
</page>
8
  • how you have added this cefore? Jan 8 '20 at 9:28
  • No, I added custom js file in xml file.
    – Yousaf
    Jan 8 '20 at 9:29
  • Check my answer Jan 8 '20 at 9:31
  • Please check my above code.
    – Yousaf
    Jan 8 '20 at 9:34
  • It is still showing same error.
    – Yousaf
    Jan 8 '20 at 9:35
1

in you layout.xml try this

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1columns" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <head>
        <script src="https://cdn.pricespider.com/scripts/test.js" src_type="url"/>
    </head>
</page>

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.