Bri*_*ipa 9 rss google-api google-feed-api
我正在使用Google Feed JSAPI来阅读/解析Feed.问题是,当Feed更改时,先前的条目变为无效(链接和图像不起作用),因此我无法加载源的缓存版本.我认为加载Feed时可以选择不使用缓存版本,但我没有看到.我的解决方案是在变量(t)中添加到feed url的末尾,因此它是"唯一的"但这看起来很糟糕(但它确实有效).有人知道更好的方法吗?
function onLoad() {
// Create a feed instance that will grab feed feed.
var feed = new google.feeds.Feed(feedLocation+"&t="+new Date().getTime());
// Request the results in XML (so that we can parse out all the info
feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
//must set this - if you don't, it defaults to 4
feed.setNumEntries(50);
// Calling load sends the request off. It requires a callback function.
feed.load(feedLoaded);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3229 次 |
| 最近记录: |