how to get <head> content of the current page with jquery or JS
-
01-10-2019 - |
Pergunta
how to get <head>
content of the current page
Solução
You could use the javascript DOM API like this:
var headContent = document.getElementsByTagName('head')[0].innerHTML;
Outras dicas
You can use an element selector to get <head>
, for example:
$("head")
//for example:
alert($("head").html()); //alerts the <head> children
Simply as:
document.head
// returns object DOM Object
document.head.innerHTML
// returns text, like: '<title>Title of the page...'
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow