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.

asked Nov 12, 2016 at 19:46
2

1 Answer 1

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"

answered Nov 13, 2016 at 10:05
1
  • Appending src_type="url" won't help Commented Nov 14, 2016 at 8:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.