Created
August 17, 2016 10:04
-
-
Save wangpin34/40567d7eb72ea7d2426ad5804b3c418b to your computer and use it in GitHub Desktop.
fetch meta info contains http-equiv, name
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
function fetchMetas() { | |
var metas = [].slice.call(document.getElementsByTagName('meta')).map(function(e) { | |
var data = {} | |
var key = '' | |
var value = '' | |
if(e.getAttribute('name')){ | |
data.name = e.getAttribute('name') | |
data.content = e.getAttribute('content') | |
return data | |
}else if(e.getAttribute('http-equiv')){ | |
data['http-equiv'] = e.getAttribute('http-equiv'); | |
data.content = e.getAttribute('content') | |
return data | |
} | |
return null; | |
}).filter(function(e){ | |
return !!e; | |
}) | |
return metas | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment