In jQuery you can do this:
$(\"meta[property=\'fb:app_id\']\").attr(\"content\");
Which will give you the content
attribute va
Note: Some use the property
attribute:
whereas others use the name
attribute:
I use the following to get the value from both variants:
var appId = (function(c) { for (var a = document.getElementsByTagName("meta"), b = 0;b < a.length;b++) {
if (c == a[b].name || c == a[b].getAttribute("property")) { return a[b].content; } } return false;
})("fb:app_id");
console.log(appId); //(bool)false if meta tag "fb:app_id" not exists.
fb:app_id
to description
).
function getContentByMetaTagName(c) {
for (var b = document.getElementsByTagName("meta"), a = 0; a < b.length; a++) {
if (c == b[a].name || c == b[a].getAttribute("property")) { return b[a].content; }
} return false;
}
console.log(getContentByMetaTagName("og:title"));