Created
March 28, 2015 14:46
-
-
Save AllThingsSmitty/248c26e57dc04f743d37 to your computer and use it in GitHub Desktop.
Get an absolute URL with JavaScript
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
var getAbsoluteUrl = (function () { | |
var a; | |
return function (url) { | |
if(!a) a = document.createElement('a'); | |
a.href = url; | |
return a.href; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment