Question

I'm looking to combine these 2 bookmarklets into 1 bookmarklet that toggles the designMode on and off:

On: javascript:document.body.contentEditable='true';%20document.designMode='on';%20void%200

Off: javascript:document.body.contentEditable='false';%20document.designMode='off';%20void%200

I had tried some if else statements but can't seem to detect if designMode was on or not. So not sure what I was doing wrong. Any help would be appreciated.

Was it helpful?

Solution

SOLVED (i had typos, oops) :

javascript:(

function () {
    if (document.documentElement.contentEditable === false || document.designMode === "off") {
        document.body.contentEditable='true';
        document.designMode='on';
        void 0;
    } else if (document.documentElement.contentEditable === true || document.designMode === "on") {
        document.body.contentEditable='false';
        document.designMode='off';
        void 0;
    }
})();

OTHER TIPS

This works on Google Chrome

   data:text/html, <html contenteditable>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top