2013-10-03 17 views

回答

1

使用動態腳本插入:

if(navigator.onLine) { 
    var script = document.createElement('script'); 
    //You must use the callback parameter when loading the script asynchronously 
    script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=initialize'; 
    var scripts = document.getElementsByTagName('script'); 
    scripts[0].parentNode.insertBefore(script, scripts[0]); 
} 

function initialize() { 
    //initialize map here 
} 

Asynchronous Loading topicGoogle Maps API v3 Documentation

您可能也有興趣Google Maps API v3: Developing for Mobile Devices

相關問題