tags:

views:

321

answers:

3

Is it possible to get access to the spell checker that is incorporated in browsers for text areas from Javascript? I would like to be able to control spell checking from withing my code. Most browsers (apart from IE) seem to have some kind of a spell checker built in to them nowadays.

+5  A: 

The most access that I know of is disabling or enabling spellchecking on a field: http://stackoverflow.com/questions/223940/inline-disabling-of-firefox-spellcheck

I don't know of a way that you can directly access the spellchecker of a browser via javascript. If you aren't particular to the spell checker of the browser, there are many open source spell checkers for javascript. Just try googling javascript spell checker.

If you really want to use the browsers spellcheck you might want to create a textbox and set the display to none. You could then put each word in the textbox and then check to see if it's underlined or not. I'm not sure of the feasability of this, just a thought. My suggestion would be to use a javascript spellchecker instead of trying to hack up a way of using the browser's spellchecker.

BoboTheCodeMonkey
Your idea of a textbox with a display set to none is intriguing but unfortunately there is apparently no way to get at the red underline for wrongly spelled words in Firefox. AJAX is pretty much the only way to go it would appear.
Rangachari Anand
+2  A: 

Browser's don't provide access to their built-in, proprietary spell checker APIs. I'm quite certain there's no x-plat way to do this, let alone a way to do it individually for each browser.

Best bet is to check with each browser vendor and see if they provide any javascript hooking of their spell checker.

I think the most they'll allow is what Bobo said; you can enable/disable it for textboxes, but I don't think they allow any further control than that.

Judah Himango
+1  A: 

Nope.

If you want control over spell checking, you could do it yourself with AJAX.

(And, incidentally, ieSpell is a free spell checker plugin for IE that is pretty easy for users to install on their own)

Eli