Every time you receive a new email, or something happens on your Facebook profile, your browser tab's name changes. For example, on gmail, if you receive a new mail, it will change to something like GMail (1)
. How can I get the same effect in my application? I think it's a Javascript thing, but I'm not sure.
This should be as simple as modifying the document.title
property with JavaScript:
document.title = "New title (1) new message";
can be done using jQuery (Javascript library)
This sample will change title of page 2 seconds after document fully loads
function changeTitle(new_value){
$("title").val(new_value); //this line changes value of <title> element
//pure javascript: document.title = new_value;
}
$(document).ready(function(){
setTimeout('changeTitle("New Title")',2000); //calls function changeTitle() after 2secs
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With