Google Places API wnd Windows 8 Metro Style App

问题描述:

我正在开发Metro风格的应用程序,需要访问Google Places API(我有应用程序密钥)。视窗8防止Java脚本的注射除非包裹在一个Google Places API wnd Windows 8 Metro Style App

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

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

任何想法?

+0

你能提供你所得到的错误吗? – 2012-04-15 14:35:00

+0

没有错误,脚本默默无法加载(由于脚本注入)。 – Ungaro 2012-06-16 02:32:59

+0

函数的名称是MSApp.execUnsafeLocalFunction!你已经写了MSapp.executeLocalUnsafeFunction – 2014-05-24 11:36:22

使用asynchronous loader。它不使用document.write

+0

试过了。 '回调'从不执行。 'google'是未定义的。 – Ungaro 2012-06-16 02:31:41

我不确定这是否会对您的问题有所帮助,但我一直收到“google未定义”的JavaScript错误信息。我编写了本教程,介绍如何在Windows 8,http://www.creepyed.com/2012/11/how-to-use-the-google-maps-api-on-windows-8/中使用Google Maps API。它与能够在Windows 8中加载外部脚本有关,它不会为Visual Studio模板执行此操作。

我希望这有助于!