[英]Using Google Map JavaScript library with cordova
我正在嘗試通過cordova項目使用Google map JavaScript API,
我得到了地圖,幾秒鍾后,我得到了file:///android_asset/www/index.html的RefererNotAllowedMapError
我也嘗試在開發者控制台上提供此URL,但是沒有運氣。
我試圖提供通配符星號符號
還有其他方法可以設置自定義引薦來源網址或如何解決此問題?
- -編輯 - -
我當時使用的是瀏覽器API密鑰,現在我改成了Android API密鑰了。
Cordova的值錯誤: https ://maps.googleapis.com/maps/api/js ? key = <瀏覽器 api鍵>
科爾多瓦的正確值: https ://maps.googleapis.com/maps/api/js ? key = < android api鍵>
似乎僅當在http url上執行html頁面時,才允許使用瀏覽器API密鑰
截至2017年5月,此問題已由Google解決。 現在,您可以使用帶有API密鑰的file:/引薦來源網址。 您可以在文檔中看到以下文本
file:// referers need a special representation to be added to the Key restriction. The "file:/" part should be replaced with "__file_url__" before being added to the Key restriction. For example, "file://path/to/" should be formatted as "__file_url__/path/to/*". After enabling file:// referers, it is recommended you regularly check your usage, to make sure it matches your expectations
https://developers.google.com/maps/documentation/javascript/get-api-key#key-restrictions
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.