I’m trying to get the RSS feeds from multiple websites. However, I ran into a problem which I’m not sure how I can solve it.
First, for some RSS feeds, my code works, like this one:
let url = "https://rss.nytimes.com/services/xml/rss/nyt/World.xml";
let xmlContent = element.responseText;
However, for many RSS url, I get a CORS error and my function doesn’t work, like for this link : http://feeds.bbci.co.uk/news/rss.xml
And the CORS error for many links like the one above : No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Why is that and how I can solve this problem? Thanks you!
According to the MDN,
If the server sends a response with an
Access-Control-Allow-Origin value that is an explicit origin (rather than the "
* " wildcard), then the response should also include a
Vary response header with the value
Origin — to indicate to browsers that server responses can differ based on the value of the
Origin request header.
How can I do to not have this type of errors, because I do not obtain the .xml when this type of errors happens.
the server block the access to this resources and it demand to subscribe.
What is this page?
This is an RSS feed from the BBC News - Home website. RSS feeds allow you to stay up to date with the latest news and features you want from BBC News - Home.
To subscribe to it, you will need a News Reader or other similar device. If you would like to use this feed to display BBC News - Home content on your site, please go here.
question markHelp, I don't know what a news reader is and still don't know what this is about.
Hi, thanks for your response,
I’m not sure the issue is with subscribing, since that I get the same issues for many websites who provides rss feed like this one: dailytelegraph.com.au/news/breaking-news/rss
You can try with others, like I said some works some doesn’t and I want them all to work, without any Cors errors.
This one doesn’t give me a cors error: https://rss.nytimes.com/services/xml/rss/nyt/World.xml
You need to use a proxy (either your own) or one like