访问外部URL(Google.com)从PhoneGap的(安卓) [英] Access external URL(Google.com) from PhoneGap(Android)
本文介绍了访问外部URL(Google.com)从PhoneGap的(安卓)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的PhoneGap和Android.I我无法从PhoneGap的访问Extrenal URL像谷歌,我想IFRAME和Window.Location.Href,但不知道为什么它不工作。
<!DOCTYPE HTML>
< HTML>
< HEAD>
<冠军>的PhoneGap< /标题>
<脚本类型=文/ JavaScript的字符集=utf-8SRC =PhoneGap的-0.9.3.js>< / SCRIPT>
<链接相对=样式表的href =jquery.mobile-1.0a1.min.css/>
<脚本SRC =jQuery的-1.4.3.min.js>< / SCRIPT>
&所述;脚本的src =jquery.mobile-1.0a1.min.js>&所述; /脚本>
< /头>
<身体GT;
< IFRAME SRC =http://www.google.com>< / IFRAME>
< /身体GT;
< / HTML>
解决方案
你有没有加入到白名单中的外部URL?有一个在 / RES / XML
文件在你的项目名为 PhoneGap.xml
下面是我的 PhoneGap.xml
文件中的一个示例:
< XML版本=1.0编码=UTF-8&GT?;
< PhoneGap的>
<获得原产地=HTTP://127.0.0.1*/>
<获得原产地=http://devgeeks.org/>
<获得原产地=HTTP://*.phonegap.com/>
<日志级别=DEBUG/>
< / PhoneGap的>
I am new to PhoneGap and Android.I am unable to access Extrenal URL' like google from PhoneGap,i tried Iframe and Window.Location.Href but not sure why it's not working.
<!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>
解决方案
Have you added the external URLs to the whitelist? There is a file in /res/xml
in your project called PhoneGap.xml
Here is an example of one of my PhoneGap.xml
files:
<?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>
这篇关于访问外部URL(Google.com)从PhoneGap的(安卓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文