Last active
June 9, 2016 11:26
-
-
Save FuruholmAnton/0f7caac66cb76cb4c6b77d77845051e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var getAbsoluteUrl = (function() { | |
var a; | |
return function(url) { | |
if(!a) a = document.createElement('a'); | |
a.href = url; | |
return a.href; | |
}; | |
})(); | |
// Usage | |
getAbsoluteUrl('/something'); // https://davidwalsh.name/something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment