Oh, and if you want to use something like the javascriptkit code, this works most of the time:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="qznews"></div>
<script>
(function(c){
var uniquename = 'qznews' // id of target div
var query = 'select * from rss(0,5) where url = "http://qz.com/feed/"'; // query as explained in original version
var numretries = 30; // increase this number (number of retries) if you're still having problems
//////// No Need To Edit Beyond Here Unless You Want To /////////
var counter = typeof c === 'number'? c : numretries;
var thisf = arguments.callee;
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
window["callback_" + uniquename + (--counter)] = function(r){
head.removeChild(s);
if(r && r.query && r.query.count === 0 && counter > 0){
return thisf(counter);
}
//r now contains the result of the YQL Query as a JSON
var feedmarkup = '<p>';
var feed = r.query.results.item // get feed as array of entries
for (var i=0; i<feed.length; i++){
feedmarkup += '<a href="' + feed[i].link + '">';
feedmarkup += feed[i].title + '</a><br />';
feedmarkup += feed[i].description + '</p>';
}
document.getElementById(uniquename).innerHTML = feedmarkup;
};
var baseurl = "https://query.yahooapis.com/v1/public/yql?q=";
s.src = baseurl + encodeURIComponent(query) + "&format=json&callback=callback_" + uniquename + counter;
head.append(s);
})();
</script>
</body>
</html>
Demo:
http://jscheuer1.com/gfeedcatch/jsk-demo-st.htm
Bookmarks