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

About these ads

3 Comments »

  1. Works great, can now check my sites spelling for SEO purposes! :)

    Comment by DevilWear — 2011-05-11 @ 09:33

  2. Great Work. I googled like anything for such utility. This code has solved my purpose. Thanks a lot :)

    Comment by Satish — 2011-08-05 @ 05:17


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The WordPress Classic Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 647 other followers

%d bloggers like this: