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 “” 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">
      <script type="text/javascript" src="https://test.com/scripts/test.js"/>
    <referenceContainer name="head.additional">
        <block class="Magento\Framework\View\Element\Template" name="pricespider.tagging.success" template="Devcrew_PriceSpider::success.phtml"/>
  • how you have added this cefore? – Waqar Ali Jan 8 at 9:28
  • No, I added custom js file in xml file. – Yousaf Jan 8 at 9:29
  • Check my answer – Waqar Ali Jan 8 at 9:31
  • Please check my above code. – Yousaf Jan 8 at 9:34
  • It is still showing same error. – Yousaf Jan 8 at 9:35

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">
        <script src="https://cdn.pricespider.com/scripts/test.js" src_type="url"/>
| improve this answer | |

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.