chriszarate/bookmarkleter

Generated bookmarklets don't work in Firefox

palant opened this issue · 2 comments

I assume that this is a Firefox-only problem, but I didn't actually test this in other browsers.

Currently the generated bookmarklet looks like this:

javascript:!function(){...}()

The result of this expression will be either false or true, depending on the return value of the function. Since the result isn't undefined Firefox will replace the contents of the current page with the text false or true which isn't usually desired. A simple change to the generated bookmarklet fixes this:

javascript:void function(){...}()

There is the same issue if "Wrap in an IIFE" isn't checked - normally adding void 0 to the end of the bookmarklet would work but UglifyJS removes it.

Thanks for reporting this ... it does seem to be restricted to Firefox. Should be able to fix it by tweaking Uglify options.

Verified, works correctly now - thank you.