NYCPHP Meetup

NYPHP.org

[nycphp-talk] Quick HTTP/Meta/PHP/JavaScript Question

Greg Rundlett greg.rundlett at gmail.com
Thu Dec 8 21:39:25 EST 2005


The Javascript function getElementsByTagName('meta') will get an array
of all the meta tags in the current webpage.

Take the following javascript, make it the 'href' attribute of a
hyperlink in your document, and you have a bookmarklet that will do
the trick.

javascript:metaTags=document.getElementsByTagName('meta');total='<h1>MetaTags:</h1><ol>';for(i=0;i<metaTags.length;i++){total=total+'<li><strong>name:</strong>%C2%A0'+metaTags[i].name+'<br
/><strong>content:</strong>%C2%A0'+metaTags[i].content+'</li>';}total=total+'</ol>';checkWindow=window.open('','metacheck','scrollbars=yes,resizable=yes,status=no,location=no,menubar=yes,toolbar=yes,width=640,height=300');checkWindow.document.write(total);



More information about the talk mailing list