For AJAX-driven pages that use the history API (most of them, including YouTube), you can insert in history.pushState .
For Chrome, the old URL will be in the spf-referer property. (In addition, location.href will still be set to the old URL, while pushState will also start.)
So, this code will work:
var H = window.history; var oldPushState = H.pushState; H.pushState = function (state) { if (typeof H.onpushstate == "function") { H.onpushstate ({state: state} ); } return oldPushState.apply (H, arguments); } window.onpopstate = history.onpushstate = function (evt) { console.log ("Old URL: ", evt.state["spf-referer"]); }
Please note that since you need to override the pushState landing page pushState , you must paste this code from your script content.
Brock adams
source share