Tried searching a lot.
could not find any solutions for onchange of page title.
There is jQuery .change()
but that is limited to "input elements, textarea boxes and select elements."
What I am trying is to give an alert whenever any script changes the title of the page.
I am building a Chrome extension that alerts the user when the document.title
has changed.
Here is a plugin, I suppose:
$.fn.titleChange = function(origTitle,callback){
setInterval(function(){
if(origTitle == document.title){
return false;
}
else {
callback();
origTitle = document.title;
}
},1000);
}
Use the above like this:
$(function(){
$(document).titleChange(document.title,function(){alert("changed");});
});