tags:

views:

73

answers:

2

Do developers have to put certain/extra elements in the feed's XML file or attributes in the hyperlink for the browser to recognize that it's a feed that can be subscribed to? Or do browsers do that automatically as long as the XML validates?

(showing users that "Subscribe to this feed using..." interface in Firefox or "You are viewing a feed that contains frequently updated content. When you subscribe to a feed, ..." interface on Internet Explorer, etc.)

A: 

The feed isn't just XML, but should follow a format such as ATOM Syndication Format or RSS.

The browsers can detect the headers indicating one of those feed formats.

[Side-note: An HTML page can point to its corresponding feed using an appropriate "alternate" link tag. This isn't about detecting that this page is a feed, but that this page has a feed.]

Oddthinking
+2  A: 

Most modern browsers are intelligent enough to inspect an XML data source and HTTP headers and determine if it represents a syndication feed (typically formatted as Atom or RSS). However, there are a couple of things you can do to improve auto-discovery of syndication feeds within a web site and when dynamically generating syndication feeds:

Auto-discovery of syndication feed(s) provided by a web site

The established way to provide feed auto-discovery for web browsers is through the use of the link element with a rel attribute value of alternate within the head of the web page. You should also specify the MIME type of the feed using the type attribute of the link, and may specify the name of the feed using the title attribute. Most browsers will support the discovery of multiple feeds (e.g. when you provide the same syndicated content in multiple formats).

Example:

<html>
  <head>
    <title>My Web Site</title>
    <link rel="alternate" type="application/atom+xml" title="My Feed (Atom)" href="/feed.aspx?format=atom" />
    <link rel="alternate" type="application/rss+xml" title="My Feed (RSS)" href="/feed.aspx?format=rss" />
  </head>
  <body>
    <!-- page content -->
  </body>
</html>

Explicitly indicate the HTTP MIME type of syndicated content

If you are dynamically generating your syndicated content, it is a good practice to explictly indicate the MIME content type. For Atom feeds, the offical registered MIME type is application/atom+xml. While there is actually no offically registered MIME type for RSS feeds, the defacto that is used is application/rss+xml.

Oppositional