Skip to content

Instantly share code, notes, and snippets.

@meniam
Last active January 28, 2016 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meniam/6d6b6266cc2103aa4835 to your computer and use it in GitHub Desktop.
Save meniam/6d6b6266cc2103aa4835 to your computer and use it in GitHub Desktop.
getAbsoluteUrl - Получить абсолютный URL
var getAbsoluteUrl = (function() {
var a;
return function(url) {
if(!a) a = document.createElement('a');
a.href = url;
return a.href;
};
})();
// Пример использования
getAbsoluteUrl('/something'); // http://davidwalsh.name/something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment