How to get the RSS URL in javascript?
September 26, 2006 12:24 PM   RSS feed for this thread Subscribe

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 comments 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 My girlfriend and I miss the c...   |   What is anti-matter?... Newer »
This thread is closed to new comments.


Related Questions
What should I learn in order to do web development? October 15, 2008
Can I make different categories of link text on a... June 21, 2007
What's the step BEFORE "newbie" called? January 4, 2007
edit javascript for FeedJumbler May 12, 2006
iFramed for a crime I didn't commit February 11, 2006