Google AJAX Feed API:无法读取属性'LINK_TARGET_BLANK'的定义
Google AJAX Feed API: Cannot read property 'LINK_TARGET_BLANK' of undefined
我使用以下代码片段(只包含几行)将RSS提要包含到我的应用程序中。
GFdynamicFeedControl.prototype.parseOptions_ = function(options){
.....
....
this.options = {
....
....
feedCycleTime : GFdynamicFeedControl.DEFAULT_FEED_CYCLE_TIME,
linkTarget : google.feeds.LINK_TARGET_BLANK,
.......
.......
}
}
FdynamicFeedControl.prototype.setup_ = function(container) {
if (container == null) return;
this.nodes.container = container;
// Browser determination code.
....
....
// The feedControl instance for generating entry HTML.
this.feedControl = new google.feeds.FeedControl();
this.feedControl.setLinkTarget(this.options.linkTarget);
// The feeds
this.expected = this.feeds.length;
this.errors = 0;
for (var i = 0; i < this.feeds.length; i++) {
var feed = new google.feeds.Feed(this.feeds[i].url);
feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
feed.setNumEntries(this.options.numResults);
feed.load(this.bind_(this.feedLoaded_, i));
}
};
在我的应用程序的JSP中使用上述函数的代码:
<script>
function LoadDynamicFeedControl() {
var feeds = new Array ();
feeds [feeds.length] =
{title: 'RSS feeds',
url: 'hard-coded URL'
};
}
var options = {
stacked : false,
horizontal : false,
title : ""
}
new GFdynamicFeedControl(feeds, 'feed-control', options);
}
// Load the feeds API and set the onload callback.
google.load('feeds', '1');
google.setOnLoadCallback(LoadDynamicFeedControl);
</script>
这段代码在Firefox上运行良好,但在chrome中它给出了错误:
"Cannot read property 'LINK_TARGET_BLANK' of undefined"
在linkTarget : google.feeds.LINK_TARGET_BLANK,
我读了这个链接,但是解决方案不起作用。
然后我看到了这篇文章:JavaScript回调函数和Google Feed API
但我不知道如何实现这个场景在我的情况下(新的谷歌api的东西)。
你能建议需要做什么改变,使代码在chrome工作?
我找到解决办法了。
我替换了语句
google.load('feeds', '1');
google.setOnLoadCallback(LoadDynamicFeedControl);
google.load('feeds', '1', {"callback": LoadDynamicFeedControl});
这对我很有用。
但随后错误被警告所取代"屏蔽了]https://.jsp的页面运行了来自http://www.google.com/uds/?file=feeds&v=1&async=2的不安全内容。"
和RSS源仍然不可见。
所以我右键点击chrome图标,从 修改目标" C: ' '应用程序数据'谷歌Chrome '程序' ' chrome.exe"
"C:''Application Data'Google'Chrome'Application' Chrome .exe"——allow-running-insecure-content
相关文章:
- 引导程序:在导航栏中,显示悬停在单个位置的基于Li Link的不同内容
- LINK rel=子资源用于什么
- 是否同步加载了LINK元素
- 此绑定与e.currentTarget与e.target
- HEAD中LINK和STYLE元素的求值顺序
- Target=_blank don'我不在mozilla和IE工作
- 使用Plaid Link显示自定义用户名和密码模式对话框
- jQuery event.target is_a_child_of(element)
- How to target an h1 inside an <a>?
- Form.target=window.opener.name不起作用
- JS new.target vs. instanceof
- $(e.target).find和template.find('input').value之间有什么区别
- 面料:“;鼠标:向下”;在event.target中未返回对象
- Target=带有OnClick JavaScript的空白链接
- 使用event.target.classlist区分按钮颜色
- 如何在 React-router 中手动调用 Link
- target=“_空白“;使用自定义javascript生成的html页面
- AngularJS复选框通过$event.target更改问题
- 如何自动添加target=“_空白“;仅限于外部链接
- Mark link's target