javascriptdecodingbookmarklet

Decode Javascript bookmarklet


I have quite long Javascript bookmarklet and i don't have source code anymore. It is possible to decode it in Notepad++ but it is stil quite hard.

Any ready tool for decoding Javascript bookmarklet?

Update: As i mentioned, i don't have source code any more. Bookmarklet have over 2000 characters and it is impossible to change anything without decoding** it.

** Decoding = changing it to human readable and editable form.


Solution

  • Not with Notepad++ per se, but bookmarklets are just JavaScript code that's been made to fit the rules for a URI (for instance, with percent-encoding). So you can "decode" it simply by removing the javascript: pseudo-protocol and passing the rest through decodeURIComponent:

    var code = decodeURIComponent(bookmarktext.substring(11));
    

    You can do this in your browser's dev tools console, for instance, then copy the source to Notepad++.