Can we set style to title tag in header

You can apply CSS to the <title> element, but not though the style attribute (since it is for “All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE“). I’m not aware of any browser that will apply CSS for the rendering of the title in browser tabs or title bars though. You can, … Read more

How can I get the title of a webpage given the url (an external url) using JQuery/JS

Something like this should work: $.ajax({ url: externalUrl, async: true, success: function(data) { var matches = data.match(/<title>(.*?)<\/title>/); alert(matches[0]); } }); TheSuperTramp is correct, above will not work if externalUrl is outside of your domain. Instead create this php file get_external_content.php: <?php function file_get_contents_curl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); … Read more

Getting title and meta tags from external website

This is the way it should be: function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); return $data; } $html = file_get_contents_curl(“http://example.com/”); //parsing begins here: $doc = new DOMDocument(); @$doc->loadHTML($html); $nodes = $doc->getElementsByTagName(‘title’); //get and display what you need: $title = $nodes->item(0)->nodeValue; … Read more