Created
June 22, 2019 17:43
-
-
Save ymschaap/a3f92e057fd9556db722fed6bcac8c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nodes = document.querySelectorAll("head link"); | |
var linkNodes = []; | |
if (nodes) { | |
for (var i = 0, len = nodes.length; i < len; i++) { | |
var node = nodes[i]; | |
var attributes = Object.values(node.attributes); | |
var el = {}; | |
for (var n = 0, len2 = attributes.length; n < len2; n++) { | |
var attribute = attributes[n]; | |
el[attribute.name.toLowerCase()] = attribute.value; | |
} | |
linkNodes.push(el); | |
} | |
} | |
console.log(linkNodes); | |
return JSON.stringify(linkNodes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment