Each bookmark is stored in a shortcut file under %USERPROFILE%/Favorites It looks like this:
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,15
[InternetShortcut]
URL=javascript:alert('oh yea')
IDList=
[Bookmarklet]
ExtendedURL=javascript:alert('oh yea')
If the URL is short, only 2 lines are enough:
[InternetShortcut]
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".