开发者

pulling and styling RSS feeds with JavaScript

开发者 https://www.devze.com 2023-02-03 21:03 出处:网络
I wonder if someone could help me with a little project im working on. Im building a news website and would like to pull in relevant RSS feeds from sites such as the BBC, WSJ and the Washington Post

I wonder if someone could help me with a little project im working on.

Im building a news website and would like to pull in relevant RSS feeds from sites such as the BBC, WSJ and the Washington Post and rather than simply display the feeds as a list I would like to split them up into individual headlines and restyle them a bit like flipboard. Once a link is clicked this will display the full website in a lightbox. Is it possible to do this with JavaScript, if so how would it be best开发者_如何学编程 achieved?

If the community could help me with this it would be great.


Browsers generally don't allow JavaScript to access content on other domain names via HttpRequest (aka AJAX) methods, primarily for security.

However, you can effectively circumvent the issue by creating a gateway on your own server to retrieve the feeds.

Depending what server tech you're using, use CURL, an HttpWebRequest or similar mechanism to retrieve the feed on your server, from a url your front end can access via an AJAX call.

I can't really post an example without knowing the specifics of the frameworks that you're using, but this is the general formula commonly used to achieve what you're looking for.

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消