HOW TO convert a RSS feeed to a JSONP feed on the fly
JavaScript cannot be used to load a feed if the domain from which the feed is originating is not the same as the site where it is going to be consumed programmatically. That's were a JSONP feed can be helpful.
JSONP does not use XMLHttpRequest (XHR). It uses the script element so data can be pulled into any site, from any site. The purpose is to circumvent the same-source policy limitations of XMLHttpRequest.
Google provides a REST-based feed conversion API, Google Feed API, to convert a RSS feeed to a JSONP feed on the fly. Here's a code sample that shows the latest 15 article titles from Scott Gu's RSS blog feed -
If Google ever pulls this plug off for this service, there are alternatives.
Comments
Post a Comment