Get absolute URL

0
Reputation

Taken from https://davidwalsh.name/essential-javascript-functions

"Getting an absolute URL from a variable string isn't as easy as you think. There's the URL constructor but it can act up if you don't provide the required arguments (which sometimes you can't). Here's a suave trick for getting an absolute URL from any string input... The "burn" element href handles any URL nonsense for you, providing a reliable absolute URL in return."

Version:



                            
    Kyle

    Kyle

    OneLib developer/administrator
    There is 1 person using this snippet in their library: