每个马克的答案.如果使用JavaScript,您将不得不获取服务器端脚本以获得效果
JavaScript :(这只会为您提供当前页面的标题):
<script language="JavaScript">
alert(document.title);
document.title='YOUR TITLE HERE'; //to set title
</script>
Run Code Online (Sandbox Code Playgroud)
这是php的方法:
$url = "http://www.google.com";
$file = file_get_contents($url);
if(preg_match("/<title>(.+)<\/title>/i",$file,$result)
print "The title of $url is <b>$result[1]</b>";
else
print "The page doesn't have a title tag";
Run Code Online (Sandbox Code Playgroud)
这是从很久以前的书签中修改到获得相同效果的信用来源