Skip to content

Instantly share code, notes, and snippets.

@bosconian-dynamics
Last active January 3, 2016 09:19
Show Gist options
  • Save bosconian-dynamics/8441863 to your computer and use it in GitHub Desktop.
Save bosconian-dynamics/8441863 to your computer and use it in GitHub Desktop.
JavaScript function to expand virtually any shortened/masked URL using the LongURL.com API v2. If a callback is passed the request will execute asynchronously, otherwise the function will block until a response has been received. Uses the "longURLAPICall()" function from http://gist.github.com/KuroTsuto/8447974
expandShortenedURL = function( str_shortenedURL, fn_callback ) {
if( str_shortenedURL.indexOf( "http://" ) < 0 )
str_shortenedURL = "http://" + str_shortenedURL;
return longURLAPICall( "expand", { title: 1, url: str_shortenedURL }, fn_callback );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment