designMode

By  on  

Every once in a while I stumble upon an API or browser setting that I can't believe ever existed. Such examples can be seen in the numerous String.prototype properties such as bold, italics, and even blink, which wrap given string text in their representative HTML tags. Bizarre.

It was recently brought to my attention the document.designMode API: an on|off switch that acts almost like a contentEdible attribute for the entire document. You can toggle designMode by simply changing the setting:

document.designMode = "on";

With the designMode setting on, you can edit page text, drag and drop assets, and generally cause chaos on the page. This is really nice for prototyping; I'd have loved to have known about this while doing client work.

While I see uses for this API, it does feel a bit bizarre. I'd have liked to have known the origins of this property and its use cases. Have ideas about how you'd use it? Share!

Recent Features

  • By
    LightFace:  Facebook Lightbox for MooTools

    One of the web components I've always loved has been Facebook's modal dialog.  This "lightbox" isn't like others:  no dark overlay, no obnoxious animating to size, and it doesn't try to do "too much."  With Facebook's dialog in mind, I've created LightFace:  a Facebook lightbox...

  • By
    How to Create a Twitter Card

    One of my favorite social APIs was the Open Graph API adopted by Facebook.  Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to, giving me a bit of control...

Incredible Demos

Discussion

  1. Hi David,

    thanks for the trigger!
    We digged deeper and unveiled the origin: https://twitter.com/slicknet/status/1180862121371811840

    That was fun :-D

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!