Google Places API wnd Windows 8 Metro Style App



我正在开发一个Metro风格的应用程序,需要访问Google PlacesAPI(我有一个应用程序密钥)。Windows 8 阻止 Java 脚本注入,除非包装在

 MSApp.executeLocalUnsafeFunction( function () { 
      document.write('…etc');
 }); 

因此,maps.googleapis.com/maps/js无法加载。

有什么想法吗?

使用异步加载器。它不使用document.write.

我不确定这是否会对您的问题有所帮助,但我不断收到"谷歌未定义"的 JavaScript 错误。我写了这个关于在Windows 8中使用Google Maps API的教程,http://www.creepyed.com/2012/11/how-to-use-the-google-maps-api-on-windows-8/。它与能够在Windows 8中加载外部脚本有关,而Visual Studio模板则无法做到这一点。

我希望这有帮助!