How does contenteditable work?
https://softwareengineering.stackexchange.com/questions/256102
-
05-10-2020 - |
Question
I recently came across an article where if you enter
data:text/html,%20<html contenteditable>
into the address bar of a browser that supports HTML5, you can type in the window.
I managed to figure out that with this you can basically write html in the address bar (it would be rather cumbersome) but
I do not understand how or why it works. What are the other functionalities of this command?
Solution
The first part - data:text/html
- is a Data URI that tells the browser that what follows is html, and it should parse it.
The second part - <html contenteditable>
- is the actual html, an editable html element. In HTML5 you can make any element editable with the contentEditable attribute.