javascript - Encoding and decoding within bookmarklet -
i want create bookmarklet lengtens shorte.st links using website.
example link: http://sh.st/**abcde**
has turned
http://longurl.org/expand?url=http%3a%2f%2fsh.st%2**abcde**
i created following code:
javascript:(function(){var str = window.location.tostring();var str1 = str.substring(13,18);var str2 = "http://longurl.org/expand?url=http%3a%2f%2fsh.st%";var str3 =str2.concat(str1);alert(str3);window.location=str3;})();
code bad, know, i've never written in javascript before. works. except 1 thing: % in bookmarklet decoded /. , dont want happen. guess somewere along way supposed encode string, i'm not sure. appreciated.
Comments
Post a Comment