Created
December 18, 2019 16:56
-
-
Save okovalov/0a392d89ee8e08b416011e27ddd5f728 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to make a page editable in the browser | |
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. | |
document.designMode = 'off' | |
This feature is supported by almost every browser, IE included. It’s pretty old, but quite unknown. | |
https://flaviocopes.com/designmode/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment