Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Include google map link

Started by Muut Archive 10 years ago · 2 replies · 409 views
10 years ago

Hi all. I work with google map on my site and need help.Ho to correctly include

HTML
    <script async defer
         src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAwYULi8da91JX86vVBeAh_ApKzcHYRxsQ&callback=initialize">
 </script>

into project via do assets.addJs. The problem is that the borwser doesnt see "async defer". I tried so, but didnt work.

TWIG
            {% do assets.addJs('https://maps.googleapis.com/maps/api/js?key=AIzaSyAwYULi8da91JX86vVBeAh_ApKzcHYRxsQ&callback=initialize',{'loading':'async'}) %}

Please help.Thanks before

10 years ago

I tested this and it totally works:

TWIG
{% do assets.addJs('https://maps.googleapis.com/maps/api/js?key=AIzaSyAwYULi8da91JX86vVBeAh_ApKzcHYRxsQ&callback=initialize',{'loading':'async defer'}) %}

I get:

HTML
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAwYULi8da91JX86vVBeAh_ApKzcHYRxsQ&callback=initialize" type="text/javascript" async defer></script>

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1366 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago