gpt4 book ai didi

javascript - Cordova windows 8 应用程序 : load external javascript (google maps)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:43:31 25 4
gpt4 key购买 nike

我有一个适用于 iOS 的 cordova 应用程序,现在我也必须为 Windows 构建它。我面临的问题是应用程序中有一个 Google map ,但是当我启动它时收到此错误:

google is undefined

在控制台中我发现了这个:

An app can't load remote web content in the local context

在我看来,问题出在外部资源加载上。
那么,我该如何解决呢?
有没有办法在 Windows 8 应用程序中加载外部资源?

非常感谢任何帮助!谢谢!

最佳答案

我也遇到了同样的问题。我找到了 this solution在应用程序中加载 Google map 。
作者使用 iFrame 来显示 map :

default.html

...
<body>
<iframe id="Map" src="ms-appx-web:///map.html" style="width:100%;height:100%;"></iframe>
</body>

map.html

<!DOCTYPE html>
<html>
<head>
<title></title>
<script
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&signed_in=true">
</script>
...

我不需要包含 map ,但想在我现有的 View 模型中使用 Google 地点库。

我希望给定的解决方案能解决您的问题。

关于javascript - Cordova windows 8 应用程序 : load external javascript (google maps),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28461605/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com