how to change the title of page through jquery?
In pure JavaScript:
document.title = "Insert title here";
the document should be fully loaded before you change it.
Reference: Document.Title at Mozilla Developer Central
Why jQuery for such minor task? Use vanilla javascript:
document.title = "My new title";
More Info:
If you still want to go with jQuery, you simply do:
$("title").html("My new title");
Simple
$("title").html("newtitle");
FOR IE
document.title = 'new title';
To change the favicon use something like this
HTML
<link REL="SHORTCUT ICON" HREF="http://yoursitedotcom.here/yourdir/favicon.ico" id="myicon">
Script
$("#myicon").attr("HREF","mynewicon.gif");
Assuming you're using the latest jQuery, doing something as simple as:
$('title').text('My new title');
should work. At least, this works doing a simple in-page javascript console test in google Chrome. You could use .html instead of .text, but generally you don't want HTML in the title tag, since that's not usually allowed and might display weirdly - with .text at least you know your new title string will be escaped and not lead to any weird behaviour.
Otherwise I expect doing something using straight javascript would be fine, such as:
document.title = 'A new title';
<script type="text/javascript">
$(document).ready(function() {
document.title = 'blah';
});
</script>
also check this http://hancic.info/change-page-title-with-jquery
document.title = "newtitle"
is the only valid way as far as I know. manipulating
$("title")
will fail on IE8.
There are subtle differences between the title tag and document.title, it appears browsers treat them differently.