Drag this Read this Page link to your bookmarks bar, open any website and this click on that bookmark to have the page read to you.
Why did I make this?
Simple. I've looked at some text-to-speech web readers and thought, I can build one of those quite simply. So I
did.
After completing the above, I thought, 'Why not make it more fully-fledged?', so here's a new bookmark to drag to your bookmarks bar ma11y.
Here's the basis of the code:
javascript: (() => {
// Removing the noscript tags, since this can't work without JS,
// and we don't want something like a Google Analytics iframe source
// read out.
const noScripts = document.querySelectorAll("noscript");
noScripts.forEach((noScript) => {
noScript.remove();
});
function readOutLoud(message) {
const speech = new SpeechSynthesisUtterance();
speech.text = message;
speech.volume = 1;
speech.rate = 0.9;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
// Read the entire page. This is what makes this a very simple reader.
// We could easily make it much more complex.
const itemToRead = document.querySelector("body").textContent;
readOutLoud(itemToRead);
})();