I have this script to generate an XML file for an RSS feed. Works great in every browser except Chrome. Chrome just renders the XML as text. Something to do with header("Content-Type: application/rss+xml; charset=ISO-8859-1");
possibly?
This is the code I'm using:
<?php $linkUp = "http://localhost/sites/myBlog/"; header("Content-Type: application/rss+xml; charset=ISO-8859-1"); $rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>Mytitle</title>'; $rssfeed .= '<link>' . $linkUp . '</link>'; $rssfeed .= '<description>Mydescription</description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>© ' . strftime('%Y') . ' . " " . ' . $linkUp . '</copyright>'; $query = "SELECT * FROM rss"; $result = $db->query($query); while($row = $db->fetch_array($result)) { $rssfeed .= '<item>'; $rssfeed .= '<title>' . $row['rss_title'] . '</title>'; $rssfeed .= '<description>' . $row['rss_description'] . '</description>'; $rssfeed .= '<link>' . $row['rss_link'] . '</link>'; $rssfeed .= '<pubDate>' . date("D, d M Y H:i:s O", strtotime($date)) . '</pubDate>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; ?>
Click on Load, enter RSS feed URL and it will output XML data on the left side and HTML data on the right side. This tool also supports to convert RSS XML to JSON. Show activity on this post. If you view the feed in Firefox it'll read like an RSS reader, but if you view the source code you've got it in XML format.
Just about every browser can open an XML file. In Chrome, just open a new tab and drag the XML file over. Alternatively, right click on the XML file and hover over "Open with" then click "Chrome". When you do, the file will open in a new tab.
RSS is a Web content syndication format. Its name is an acronym for Really Simple Syndication. RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium (W3C) website.
You can follow a site through the browser's three-dot menu to subscribe to its RSS feed and have it update in your Chrome app. Sites you're following will appear in a tab called “following,” which sits along Google's “for you” tab of recommended articles.
This is a known bug in chrome that has yet to be fixed, chrome does not display xml rss feeds with any formatting whatsoever.
Update: There is now an RSS subscription / reader extension for Chrome.
I had this same problem and I used "application/xml" and it fixed it right up. Chrome doesn't like "application/rss+xml".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With