Skip to content

Instantly share code, notes, and snippets.

@luckycdev
Created April 28, 2022 00:47
Show Gist options
  • Save luckycdev/df4ae50997927cb77d5814d6fa2443e9 to your computer and use it in GitHub Desktop.
Save luckycdev/df4ae50997927cb77d5814d6fa2443e9 to your computer and use it in GitHub Desktop.
(not that good) tinyurl link shortener bookmarklet

Shortens the link of your current page

Code:

javascript:
var a="https://tinyurl.com/create.php?url=";
var b=location.host;
var c=location.pathname+location.search;
if (b==="")
{
alert("invalid response");
}
else if (b===" ")
{
alert("invalid response");
}
else if (b!=null)
{
open(a+b+c);
}

Bookmarklet:

javascript:var a="https://tinyurl.com/create.php?url=";var b=location.host;var c=location.pathname+location.search;if (b===""){alert("invalid response");}else if (b===" "){alert("invalid response");}else if (b!=null){open(a+b+c);}
javascript:var a="https://tinyurl.com/create.php?url=";var b=location.host;var c=location.pathname+location.search;if (b===""){alert("invalid response");}else if (b===" "){alert("invalid response");}else if (b!=null){open(a+b+c);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment