다음 코드를 사용하여 (몇 줄만 포함) 애플리케이션에 RSS 피드를 포함합니다.Google AJAX 피드 API : 정의되지 않은 'LINK_TARGET_BLANK'속성을 읽을 수 없습니다.
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>
코드의 조각 파이어 폭스에서 잘 작동하지만 크롬에서 오류 제공 : 상기
"Cannot read property 'LINK_TARGET_BLANK' of undefined"
을 라인 linkTarget : google.feeds.LINK_TARGET_BLANK,
r ead this 링크가 있지만 솔루션이 작동하지 않았습니다. (새 API를 물건을 Google에) JavaScript Callback Functions and Google Feed API
하지만 내 경우에이 시나리오를 구현하는 방법을 모른다 :
그런 다음이 게시물을 가로 질러왔다.크롬에서 코드가 작동하도록 변경해야 할 사항을 제안 해주십시오.