Created
November 9, 2018 17:59
-
-
Save SukkaW/954eb690be7cf68b411a645e93adbd70 to your computer and use it in GitHub Desktop.
Return to previous page.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* return-prev.js | |
* Author: SukkaW (https://skk.moe) | |
* License: MIT | |
* | |
* @param {Object} Element selector for link | |
*/ | |
(function(El) { | |
if (document.referrer && document.location.host && document.referrer.match(new RegExp("^https?://" + document.location.host))) { | |
El.setAttribute("href", document.referrer); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment