Find RSS Feed Links With jQuery

This took me a little while to figure out so I thought I’d share. You can use a jQuery selector to find any RSS links on a page very easily.

The following line will return a list of the RSS link elements.

var link_elements = $('link[type="application/rss+xml"]');

The following snippet will create an array of all the urls to the RSS feeds on the page.

var links = [];
$('link[type="application/rss+xml"]').each(function() { links[links.length] = this.href; });
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s