无法获取Google Feed;它没有加载。它在浏览器中工作正常,省略了phonegap库等。通常有帮助,这是代码。 -
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Testly</title>
</head>
<body>
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<a href="#" onclick="var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');">CNN Link</a>
</div>
<div class="f">loading...</div>
<script type="text/javascript" src="phonegap.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", function (e) {
e.preventDefault();
}, false );
} </script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript"> /*feed control*/
google.load("feeds", "1", {'nocss' : 1});
function OnLoad() {
var feedControl = new google.feeds.FeedControl();
feedControl.setNumEntries(25);
feedControl.addFeed("http://feeds.feedburner.com/Techcrunch");
feedControl.draw(document.querySelector(".f"));
}
google.setOnLoadCallback(OnLoad);
</script>
<style>
.f{
margin:20px;
overflow:scroll;
width:400px;
height:400px;
}
</style>
<script type="text/javascript">
app.initialize();
</script>
</body>
</html>
无法加载供稿,其他工作正常。
答案 0 :(得分:0)
感谢您的帮助@Drew @divoto。使用firebug进行检查并将所有可能的域列入白名单;以前没有列入白名单。这是列表 -
<access origin="*.google.com" />
<access origin="*.googleapis.com" />
<access origin="*.gstatic.com" />
<access origin="*.googleusercontent.com" />
<access origin="google.com" subdomains="true"/>
<access origin="googleapis.com" subdomains="true"/>
<access origin="gstatic.com" subdomains="true"/>
<access origin="googleusercontent.com" subdomains="true"/>