How to get the RSS URL in javascript?
September 26, 2006 12:24 PM

How do I access the RSS URL defined in the tag of a page, using javascript?

I want to use a bookmarklet to capture the RSS URL of the page I'm looking at. I'm sure there must be a document.something property that I could access, but I don't know enough javascript to figure it out.
posted by teaperson to Computers & Internet (4 answers total)
Detect RSS - via Laughing Meme
posted by slhack3r at 12:36 PM on September 26, 2006


The bookmarklet was stripped by Mefi's XSS filtering - I figured that would happen. Visit Laughing Meme for the unfiltered bookmarklet.
posted by slhack3r at 12:37 PM on September 26, 2006


I wrote one that turns out to be nearly the same as the previous answer, but I don't want it to be for naught:
javascript:var links = document.getElementsByTagName('link'); for (var i = 0; links[i] && links[i].getAttribute('type') != 'application/rss+xml'; ++i); if (links[i] && links[i].hasAttribute('href')) alert(links[i].getAttribute('href'));

posted by moift at 12:42 PM on September 26, 2006


This one will alert for all if there are multiples instead of just the first
javascript:var links = document.getElementsByTagName('link'); for (var i = 0; links[i]; ++i) { if (links[i].getAttribute('type') == 'application/rss+xml' && links[i].hasAttribute('href')) alert(links[i].getAttribute('href')); }

posted by moift at 12:54 PM on September 26, 2006


« Older Big Apple Cider?   |   Is there really a Bizarro World? Newer »
This thread is closed to new comments.