Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Include google map link

Started by Muut Archive 10 years ago · 2 replies · 499 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 2597 9 years ago
Archive · by Muut Archive, 9 years ago
2 1706 9 years ago
Archive · by Muut Archive, 9 years ago
2 4999 9 years ago
Archive · by Muut Archive, 9 years ago
1 3830 9 years ago
Archive · by Muut Archive, 9 years ago
3 1814 9 years ago