
I want to use a web browser like a notepad, using only built-in features.
This page has been translated by machine translation. View original
Hello, this is Chiba (Yuki).
Have you ever wanted to jot down a quick note in your web browser? I have.
Suppose you are sharing your web browser screen during a web meeting. In that flow, you write a summary of the meeting in a note, and then paste what you wrote directly into a chat tool or a reply email to a customer. Being able to create the "summary note" in a state that participants can see makes things go smoothly, doesn't it?
Of course, there are plenty of services where you can write text in a web browser, such as Google Docs and Notion, so they are sometimes enough. However, when you want to quickly write a note while you have a completely unrelated tab open, opening a suitable page or a new blank page is a hassle. Re-sharing the screen to show the notepad app on your computer is also a hassle.
I'll introduce a way to realize the wish of opening a new "notepad" in a web browser tab with a single click from a bookmark, without doing anything particularly difficult.
Summary first
- If you enter
data:text/html, <body contenteditable>in the web browser's address bar, you can use it like a notepad - The mechanism is just a combination of the "
data:scheme" and the "contenteditableattribute" - Appearance and protection against accidental operations can be adjusted by adding a little to the URL
Here is what it looks like. The text you type yourself is reflected as you go. You can also use common shortcuts for bold, italics, and so on.

If you register this URL as a bookmark, you can open a "notepad" in your web browser with one click. I confirmed it works in Google Chrome, but I think it works in most web browsers.
How the web browser "notepad" works
Since we're here, let's check why it works this way.
The data: scheme
The overwhelming majority of URLs entered into a web browser start with https://. The https: part at the beginning of a URL indicates the protocol to use, and is called the scheme. This time it's the data: scheme.
A URL starting with data: contains the data itself inside the URL. It takes the following syntax.
data:[<media-type>][;base64],<data>
<media-type>: The MIME type indicating the type of data. This time we specifytext/html;base64: Indicates whether the data should be base64-decoded. We omit it this time,: Note that a comma comes in between<data>: The content of the data. This time we specify<body contenteditable>.
To restate the URL for this time:
data:text/html, <body contenteditable>
Since we specify text/html as the MIME type this time, the browser interprets everything after the comma as an HTML document and displays it. In other words, a single web page can be made up from the URL alone.
What is the contenteditable attribute?
contenteditable is an HTML attribute that makes the element it is applied to directly editable by the user.
<p contenteditable>この段落は直接書き換えられます</p>
If you attach this to <body>, the whole page becomes editable. Even if <html> and <head> are omitted in HTML, the browser fills them in, so <body contenteditable> alone is enough to make a single page.
The mechanism this time is that by combining it with the data: scheme, you get "HTML that can be opened directly from a URL and whose entire page is editable."
Making the web browser "notepad" a little more convenient
I want to keep the URL simple, so I bookmark the URL exactly as written at the beginning. However, there are occasions when I find that somewhat inconvenient, so you can also try tweaks like the following, for example.
Adjusting the title and appearance
Adding <title> lets you give the tab a name. Also, making the text larger and adding margins on the left and right makes it easier to read.
data:text/html;charset=utf-8,<title>メモ</title><body contenteditable style="font:20px/1.6 sans-serif;max-width:40em;margin:2em auto">
Note that if you use Japanese in <title>, add ;charset=utf-8 right after text/html. If you don't, the title will be garbled.

Removing the red wavy lines
When you write English words, red wavy spellcheck underlines appear. You can remove them by adding spellcheck="false".
data:text/html;charset=utf-8,<title>メモ</title><body contenteditable spellcheck="false" style="font:20px/1.6 sans-serif;max-width:40em;margin:2em auto">
Showing a confirmation when closing the tab
What you write in this "notepad" is not saved in any particular way, and it disappears when you close the tab or reload. By adding onbeforeunload="return 1", a confirmation dialog will appear.
data:text/html;charset=utf-8,<title>メモ</title><body contenteditable spellcheck="false" onbeforeunload="return 1" style="font:20px/1.6 sans-serif;max-width:40em;margin:2em auto">

Changing the background color
If you want a dark theme, for example, specify colors like background:%23111;color:%23eee". A # in a URL is interpreted as the start of a fragment, so it is replaced with %23.
data:text/html;charset=utf-8,<title>メモ</title><body contenteditable spellcheck="false" onbeforeunload="return 1" style="font:20px/1.6 sans-serif;max-width:40em;margin:2em auto;background:%23111;color:%23eee">

A few things to keep in mind when using the web browser "notepad"
If you paste content copied from elsewhere into the HTML page constructed this time, it is pasted as rich text. Unneeded decorations such as text background color, fonts, and sizes may come along.
If the broken appearance bothers you, work around it by pasting without formatting (Command + Shift + V on macOS, Ctrl + Shift + V on Windows).
If you find it a hassle to be mindful of this every time, set the value of contenteditable to plaintext-only.
data:text/html;charset=utf-8,<title>メモ</title><body contenteditable=plaintext-only spellcheck="false" style="font:20px/1.6 sans-serif;max-width:40em;margin:2em auto">
Conclusion
It was simple, but this was a story about wanting to use a web browser like a notepad.
During web meetings with customers, I often talk while projecting project management tools or architecture diagrams in the web browser. Having a new "notepad" that I can open quickly in that situation is convenient, because I can summarize things while looking at them together, saying things like "So the next actions for each of us look like this, right?"
It's not something you'd be in great trouble without, but having it feels "quietly convenient!" in all sorts of situations.
This is a little tip that has been passed down in conversation within our company for a long time, but I wanted to spread it more widely, so I wrote it up in a blog post again.
I hope it helps someone.
That was Chiba Yuki (@batchicchi).