<!DOCTYPE>
<html>
<head>
<title>Get Comment With Blogger Javascript API</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load("gdata", "1.x", { packages : ["blogger"] });
</script>
<script type="text/javascript">
function _run() {
/*
* Retrieve a list of blog post comments
*/
// Obtain a reference to the 'content' div
var content = document.getElementById('content');
// Create the blogger service object
var bloggerService =
new google.gdata.blogger.BloggerService('com.appspot.interactivesampler');
// The feed for a single blog. (In this case, Linus Torvalds' Blog.)
//
// The ID included in this URI can be retrieved from the <link rel="me">
// element in the Blog's HTML source
var feedUri = 'http://www.threelas.com/feeds/posts/default';
// The callback method used when getBlogPostFeed() returns blog entries
var handleBlogPostFeed = function(blogPostsFeed) {
// Display blog's title and clear 'Loading...' message
content.innerHTML = '<p><strong>Blog:</strong> '
+ '<a href="'
+ blogPostsFeed.feed.getLink('alternate').getHref()
+ '">'
+ blogPostsFeed.feed.getTitle().getText()
+ '</a></p>';
var postEntry = new Array(); //this to call posts
var commentsFeedUri = new Array(); //this to call comments
for(var i = 0;i<5;i++){
postEntry[i] = blogPostsFeed.feed.getEntries()[i]; //call posts
commentsFeedUri[i] = postEntry[i].getRepliesLink().getHref(); //call comments
bloggerService.getBlogCommentFeed(commentsFeedUri[i], handleCommentFeed, handleError);
}
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.