Recently I found myself in dire need of a Link header parser. Not finding anything useful (or built-in!) I had to write one myself. Here it is.
Basically, let’s say you have a bunch of Link headers in your response:
Link: <http://example.org/.meta>; rel=meta, <http://example.org/.acl>; rel=acl
All you need to do now is to pass them to the parser like this:
var r = parseLinkHeader(xhr.getResponseHeader('Link')
Then, based on the rel type you are interested in, you just get the href value:
r['acl']['href'] outputs http://example.org/.acl