0

In default_head_blocks.xml I've loaded following jquery.

<link src="//maps.googleapis.com/maps/api/js"/>
<link src="js/main.js" order="101"/>

Now my situation I want map js loaded to be first but it's not working I've set the order parameter in my custom js but it's not working with external js, Even I tried with requirejs but I'm getting following error in console.

js:85 Uncaught TypeError: Cannot read property 'firstChild' of null(…)

So what can be solution here??

EDIT Even If I place it like following

<link src="//maps.googleapis.com/maps/api/js" src_type="url" />

This won't change anything in order...I want this file to be loaded before my custom file called.

0

Try this,

<?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="https://www.google.com/recaptcha/api.js" src_type="url"/>
    </head>
</page>

You need to add this src_type="url"

  • Appending src_type="url" won't help – Kaushal Suthar Nov 14 '16 at 8:57

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.