【问题标题】:Google Places API wnd Windows 8 Metro Style AppGoogle Places API 和 Windows 8 Metro Style 应用程序
【发布时间】:2012-04-26 10:36:59
【问题描述】:

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

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

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

有什么想法吗?

【问题讨论】:

  • 你能提供你得到的错误吗?
  • 没有。没有错误,脚本静默加载失败(由于脚本注入)。
  • 函数的名字是MSApp.execUnsafeLocalFunction!你写了 MSapp.executeLocalUnsafeFunction

标签: google-maps-api-3 microsoft-metro javascript-injection


【解决方案1】:

我不确定这是否会对您的问题有所帮助,但我不断收到类似于“google undefined”的 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 模板则无法做到这一点。

我希望这会有所帮助!

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 试过了。 “回调”永远不会执行。 'google' 未定义。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-03
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多