使chrome显示为RSS供稿(2) [英] Make chrome display an rss feed (2)

查看:85
本文介绍了使chrome显示为RSS供稿(2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是对此的后续行动: 获取google chrome以查看rss feed

This question is a follow-up on this one: get google chrome to view an rss feed

我从此页面复制了源代码(希望网站所有者可以这样做):
http://www.petefreitag.com/rss/.
我转义了所有引号,并制作了一个php文件.该文件如下所示:

I copied the source code from this page (hope this is ok for the site-owner):
http://www.petefreitag.com/rss/.
I escaped all quotes and made a php file out of it. The file looks like this:

<?php

header('Content-Type: application/rss+xml');

echo "<?xml version=\"1.0\" ?>
<?xml-stylesheet type=\"text/css\" href=\"http://www.petefreitag.com/rss/simple_style.css\" ?>

<rss version=\"2.0\">
    <channel>
        <title>Pete Freitag's Homepage</title>
        <link>http://www.petefreitag.com/</link>
        <description>Covering ColdFusion, Java, Web Development, and other topics</description>
        <language>en-us</language>
        <lastBuildDate>Fri, 23 Mar 2012 18:57:00 GMT</lastBuildDate>
        <ttl>45</ttl>

        <item>
REST OF THE SOURCE CODE
</rss>
";
?>

在这里您可以看到结果: http://web.student.tuwien.ac.at/~ e0250890/rsstest/test.php

Here you can see the result: http://web.student.tuwien.ac.at/~e0250890/rsstest/test.php

但是,在 http://www.petefreitag.com/rss/ chrome浏览页面作为rss feed,在我的示例中,它仅显示源代码.

However, on http://www.petefreitag.com/rss/ chrome views the page as rss feed, in my example it shows just the source code.

有什么区别,我如何强制chrome以rss feed的形式查看页面?

What is the difference and how can I force chrome to view the page as rss feed?

推荐答案

尝试将标题更改为application/xml

这通过更改标题对我有用:

This worked for me by changing the header:

<?php 
header('Content-Type: application/xml');
echo file_get_contents('http://web.student.tuwien.ac.at/~e0250890/rsstest/test.php');
?>

Mozilla接受整个标头

Mozilla accepts a whole range of headers

text/xmlapplication/xmlapplication/rss+xmlapplication/atom+xml

但是chrome似乎只接受text/xmlapplication/xml

But it seems chrome accepts only text/xml or application/xml

不确定100%为什么,也许您应该与google接洽; p

Not 100% sure why, perhaps you should take it up with google ;p

这篇关于使chrome显示为RSS供稿(2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆