Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

ClientResources.RequireScript - Possible to use async or defer?

Vote:
 

I've created a Google Maps block for usage on my website.

At the top of the block I have something like this:

@{
    var clientScript = string.Format("https://maps.googleapis.com/maps/api/js?key={0}&callback=initMap", Model.ApiKey);
    ClientResources.RequireScript(clientScript).AtFooter();
}

And then in my layout I have this:

@Html.RequiredClientResources("Footer");

This is working.  However, Google recommends adding `async` and `defer` to the script tag for Google Maps, like so:

How can we instruct Episerver to inject async and defer attributes on the script tag which is output?

#194773
Jul 02, 2018 17:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.