<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.blogger.com/rsd.g?blogID=7487871339000666216" />
How can I get the href attribute of this link tag without using any javascript library?
Right now I'm using the code below to achieve this but I want to know whether there is a simpler solution.
var links = document.getElementsByTagName("link");
for (i in links){
var title = links[i].getAttribute("title");
if ( title == "RSD"){
var href = links[i].getAttribute("href");
break;
}
}
Modern browsers support querySelector() and querySelectorAll():
document.querySelector("link[title=RSD]").getAttribute("href");
See browser support chart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With