Generate bookmarklet link from JavaScript file


Tagged ,

Recently I am working on a bookmarklet, I find it quite troublesome to always minify the JavaScript file I am working on using JSMIN and paste it into an anchor link of a blank HTML.

Then I came across a handy (thought it is written quite long long time ago) script called FJS Bookmarklet Generator.

Simply include the FJS.js and http.js from the site and call the function as follows on a blank HTML:

function callback(e) {
var container = document.getElementById('container');
container.appendChild(e);
}

FJS.write = 0;
FJS.Rinstall('Bookmarklet name', 'JavaScript file path', callback);

After the page loads you will get a bookmarklet link of your JavaScript file with Bookmarklet name as the anchor text.

no comments

RSS / trackback

respond