문제

how to get <head> content of the current page

도움이 되었습니까?

해결책

You could use the javascript DOM API like this:

var headContent = document.getElementsByTagName('head')[0].innerHTML;

다른 팁

You can use an element selector to get <head>, for example:

$("head")
//for example:
alert($("head").html()); //alerts the <head> children

You can give it a try here

Simply as:

document.head

// returns object DOM Object

document.head.innerHTML

// returns text, like: '<title>Title of the page...'

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top