Developer42

2011-03-28

Button to spell check a web-page in Google Chrome

Filed under: Google, Technology — Developer42 @ 20:32

A question recently popped up on the Chromium discussion forum asking if there was a way to get Chrome to apply its spell check to a whole website, as opposed to just a text box. Though I don’t know of one, I thought of a little javascript workaround. Copying and pasting the code below into your address bar will copy the text content of the website into a textarea causing Chrome to automatically spell check the contents. Not ideal, but nice for anyone who enjoys scripts.

javascript:var ta=document.createElement('textarea'); var s=document.createAttribute('style'); s.nodeValue='width:100%;height:100em;'; ta.setAttributeNode(s); ta.appendChild(document.createTextNode(document.body.innerText)); document.body.appendChild(ta); ta.focus(); for(var i=1;i<=ta.value.length;i++)ta.setSelectionRange(i,i);

Useful resource: Getting & setting the caret (text cursor) position
Original Question: Q. Button to spell check a web-page

Advertisements

Create a free website or blog at WordPress.com.

%d bloggers like this: