Get it

Setup

  1. Create a public* directory to hold all your bookmarklets. (*within your web root; this will work on private testing servers)
  2. Configure and place the script in your new directory.
  3. For each bookmarklet, include an element with a unique id in which the link will be embedded and a script element:
    <div id='myBM'></div>
    <script type="text/javascript"
    src="/bookmarklets/bm.php?action=getScript&amp;file=myCompressedBM.js&amp;name=My%20Bookmarklet&amp;container=myBM"
    ></script>

Bookmarklet creation & testing

  1. Best practice is to start with a template that uses a closure to hide all inner variables and functions. I also have a template for affecting all frames in a frameset.
  2. While testing the script, append &amp;test=1 to the end of the src attribute of the script element described above. This forces the script to load as an external script for easier debugging.
  3. Aggressively comment your source!
  4. Test...
  5. When you're done, create a compressed source version using something like Dean Edwards' Packer . Don't lose your uncompressed source!
  6. If you wish to comment your compressed source, use only /* multi-line comments */ at the very top of the file.
  7. Remove &amp;test=1 from the script src attribute to embed the full compressed source into the link's href attribute.

security caveats