Is there a way to write a JS function and then use it later in your browser on any web page? I know I've seen things like this before but can't manager to find it on the web.

So, let's say I have this function I found on StackOverflow that will convert a JSON string to a x-www-urlencoded string.

var toWWWFormEncoded = (params) => {
    var query = "";
    for (key in params) {
        query += encodeURIComponent(key)+"="+encodeURIComponent(params[key])+"&";
    return query

Where can I store it and how would I use it after storing it?


Firefox supports "bookmarklets" which are java snippets that run on the current page as if you run them from the developer console.

Firefox help on how to use and install them is at Use bookmarklets to quickly perform common web page tasks

There is a site with a catalogue of bookmarklets at Marklets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.