The first script block is blocked until the browser loads the script file and then executes it. You will be able to use maps directly after the script block. Its a synchronous download option.
The following 2 options are asynchronous.
The second parameter tells the google map to initialize, and then calls the method specified by the callback parameter. With this approach, you decide when is the best time to download api maps. Thus, on request or after loading the page.
The third approach loads api maps through google javascript loader. This gives you the same benefits as the second option, you just donβt need to write the script tag insert manually. The google loader docs also say that your page has already been loaded when you call it ( https://developers.google.com/loader/ ). However, in this case you download an additional file, but you can also use it to load other libraries, for example, for example. JQuery the google loader also suggests specifying a callback parameter in the third object argument, which will be called when the script is available.
gnalFF
source share