android - 从 PhoneGap(Android) 访问外部 URL(Google.com)

标签 android cordova

我是 PhoneGap 和 Android 的新手。我无法从 PhoneGap 访问外部 URL,例如 google,我尝试了 Iframe 和 Window.Location.Href,但不确定为什么它不起作用。

<!DOCTYPE HTML>
<html>
<head>
<title>PhoneGap</title>
<script type="text/javascript" charset="utf-8" src="phonegap-0.9.3.js"></script>


<link rel="stylesheet" href="jquery.mobile-1.0a1.min.css" /> 
<script src="jquery-1.4.3.min.js"></script> 
<script src="jquery.mobile-1.0a1.min.js"></script>

</head>
<body>
<iframe src="http://www.google.com"></iframe> 
</body>
</html>

最佳答案

您是否将外部 URL 添加到白名单?在您的项目中的 /res/xml 中有一个名为 PhoneGap.xml

的文件

这是我的一个 PhoneGap.xml 文件的示例:

<?xml version="1.0" encoding="utf-8"?>
<phonegap>
    <access origin="http://127.0.0.1*"/>
    <access origin="http://devgeeks.org"/>
    <access origin="http://*.phonegap.com"/>
    <log level="DEBUG"/>
</phonegap>

关于android - 从 PhoneGap(Android) 访问外部 URL(Google.com),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9174856/

相关文章:

android - 在 Activity 之间传递 DefaultHttpClient

android - 在内部存储与外部存储中存储应用程序图像

ios - 背景音频不适用于 iOS 上的 Ionic3 + Videogular2

javascript - ionic 框架调用 View 中的 ui-router 问题

android - 电容器 - 为 cors 设置原点

android - 摄像头 2,增加 FPS

javascript - 使用 touchstart 会导致屏幕在 touchstart 时变得模糊

jquery - Phonegap iOS iScroll 5 View 在虚拟键盘上向上移动

Android Gradle 主项目和子模块风格

ios - 使用 ionic 模拟 iOS,当前模拟失败,错误为 : Timed out waiting for device to boot.