RSS2 - getting browser readers to display it
I have a simple and validated RSS2 test document with two "items".
I have an RSS "link" element in the head section of a web page pointing to the RSS2 XML page.
I have an RSS button in the content of that web page, with a normal href pointing to the RSS2 XML page.
In Safari --
if I click on Safari's "RSS" icon in the browser address bar, I get the Safari RSS reader as expected, but only the first of the two "items" appears (if I comment out that first开发者_Go百科 item, then the second item appears instead)
if I click on my content RSS button, I get the raw XML code in the browser window
In Firefox --
- if I click on either Firefox's syndication icon in the browser address bar, or on my content RSS button, I get "This XML file does not appear to have any style information associated with it. The document tree is shown below."
Maybe a different browser would solve your problems.
You need to make sure you're sending an appropriate MIME type HTTP header.
Content-Type: application/rss+xml
is fairly standard.
The Safari problem may be caused by the date filter in the sidebar. Make sure you've got "All" selected.
(I don't have an SO account so I can't add comments to my original question or other answers. Thanks grahamparks, you got me on the right tip.)
Using a unique "guid" for each "item" has solved the problem of only one item appearing in Safari.
The other problems have been solved just by putting the files up on a web server.
Surprisingly it doesn't seem to be a mime type issue though -- the browsers' RSS readers kick in to display the RSS doc properly even if the RSS file is served as text/html. So I'm guessing it must be that the browser RSS readers don't like local "file://" addresses (on Mac).
精彩评论