I have a script that call a function on document ready. It works well when I load facebook from the browser, but when for example I click on my profile photo, it goes on my profile but the script doesn't reload itself because facebook maybe use ajax for page changing. How can I reload my script when I change the page using internal link on facebook? This is my script:
// ==UserScript==
// @name Facebook Script
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.facebook.com/*
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
(function() {
'use strict';
function facebook()
{
...
}
$(document).ready(function(){
facebook();
});
})();
I'm using Chrome.
Edit: I don't need to reload my script for every ajax call but only on page changed from ajax. And I need to reload my script when the document is ready after the page changed.