Finding Previous Url From Window.history
I've hosts file blocking so time to time, I get these 'Page not found' errors browsing thru deals. Since I got tired of copying the target url, unescaping, replacing it in address
Solution 1:
Found a way (at least while it lasts!)
Chrome sets the entire URL in document.title
, so querying it is all that's needed. Here's the modified code if anyone's interested:
(function () {
var href = document.title;
var loc = href.lastIndexOf('http');
if (loc > 0) {
var endLoc = href.indexOf(' is not available', loc);
endLoc = endLoc > 0 ? endLoc : href.length;
window.location.href = unescape(unescape(href.substring(loc, endLoc)))
}
})()
Note: The double unescape
is needed for links coming via Google Ads.
Post a Comment for "Finding Previous Url From Window.history"