Skip to content

How to make a page editable in the browser

New Course Coming Soon:

Get Really Good at Git

There is a special and pretty secret mode in browsers, called design mode.

There is a special and pretty secret mode in browsers, called design mode.

When you set a page into design mode, you can edit the content of the page directly inside the browser page, which is very handy to test some prototype or check out how a new headline would look, for example.

How do you enable it? Open the DevTools console, and type:

document.designMode = 'on'

The same result can be triggered by enabling contentEditable on the body element, like this:

document.body.contentEditable = true

You can edit text, delete it, and also drag images around to reposition them.

designMode in action

You can turn off the mode by using

document.designMode = 'off'

This feature is supported by almost every browser, IE included. It’s pretty old, but quite unknown.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!
→ Read my DOM Tutorial on The Valley of Code
→ Read my Browser Events Tutorial on The Valley of Code
→ Read my Browser APIs Tutorials on The Valley of Code

Here is how can I help you: