Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
javascript
phantomjs
02get_titletag_jquery_loc.js
02get_titletag_jquery_loc.js
/** * Get HTML content from URL * Get content from HEAD tag with jQuery selector * jQuery is included from local file ./assets/js/jquery/1.11.1/jquery.min.js */ var page = require('webpage').create(), url = 'http://www.mikosoft.info'; page.open(url, function(status) { if(status === 'success') { var inj_tf=page.injectJs('./assets/js/jquery/1.11.1/jquery.min.js'); //returns true or false if(inj_tf){ console.log('jQuery injected from local file!'); var tit = page.evaluate(function() { tit = $('head').html(); return tit; }); console.log("Head tag contains: \n\n"+tit); phantom.exit(); } } else { console.log('404 Not found: '+url); phantom.exit(); } });
Reload page
Preview
W3C validation
Edit Code
JS Console