隨需載入UrMap API (include on demand)

發表於 十二月 29, 2008. 分類: API問題 |

有時候有些網頁不需要在一開始就載入urmap api,有可能是使用者觸發某個動作才要顯示地圖,這時候用原本取得API的方式(document.write)就無法作到include on demand,因此我寫了一個小程式,經過壓縮之後只有1.6kb。接下來你只要呼叫

loadUMap();

就可以顯示URMAP地圖了。

這之js檔的參數跟你在取得urmap api時所下的參數一模一樣,同樣你必須取得API key才能夠使用這隻js檔(取得UrMap API sn),若在載入完成之後要做你自定義的動作,可以再傳參數callback。例如:

loadUMap(showMap);

像這樣:

範例檔案連結↗

http://api.urmap.com/js/loadUMap.php?key=xxxxxx

Make a Comment

發表迴響

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

連結到 %s

2 回應 to “隨需載入UrMap API (include on demand)”

RSS Feed for urmapapi Comments RSS Feed

隨需載入UrMap (include on demand)…

有時候有些網頁不需要在一開始就載入urmap api,有可能是使用者觸發某個動作才要顯示地圖,這時候用原本取得API的方式(document.write)就無法作到include on demand,因此我寫了一個小程式,經過壓…


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

Follow

Get every new post delivered to your Inbox.