Skip to content

Instantly share code, notes, and snippets.

Created September 9, 2020 03:28
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
JavaScript Bookmarklet in IE

Each bookmark is stored in a shortcut file under %USERPROFILE%/Favorites It looks like this:

URL=javascript:alert('oh yea')
ExtendedURL=javascript:alert('oh yea')

If the URL is short, only 2 lines are enough:

URL=javascript:alert('oh yea')

This shortcut file seems to be encoded in Windows default encoding (ANSI code page 1252). Don't try to put weird emoji in URL. But the URL can contain spaces. It's enough for embeded javascript. This shortcut file use format INI, so I guess the URL is terminated with a EOL separator.

IE11 in Windows 10 allows favorite to contain URL upto 5119 bytes (not characters). It's stored in ExtendedURL. URL contains a truncated string (maximum 2083 bytes) of ExtendedURL. The tooltip is further truncated (down to 255 bytes).

If you change ExtendedURL, but forget to update URL, then the bookmarklet won't work anymore.

Note that function alert can show long text message, except when alert dialog has a checkbox "Don't let this page create more messages".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment