最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add spell check to my website - Stack Overflow

programmeradmin2浏览0评论

I have an asp-based website which I would like to add spell checking capabilities to the textarea elements on the page. Most of the pages are generated from an engine, though I can add JavaScript to them. So my preferred solution is a JavaScript-based one. I have tried JavaScriptSpellCheck and it works okay, though I would like to see what some of my other options may be. I also found spellchecker but at $3500 for a server license it seems excessive.

Spell checking can be in a separate window and must support multiple languages (the more the better). Ultimately I would like to send the spell check object a collection or delimited string of textarea names or id's (preferably names as they already exist in the pages) and have it spell check all of them, updating the text as spelling is corrected.

I have an asp-based website which I would like to add spell checking capabilities to the textarea elements on the page. Most of the pages are generated from an engine, though I can add JavaScript to them. So my preferred solution is a JavaScript-based one. I have tried JavaScriptSpellCheck and it works okay, though I would like to see what some of my other options may be. I also found spellchecker but at $3500 for a server license it seems excessive.

Spell checking can be in a separate window and must support multiple languages (the more the better). Ultimately I would like to send the spell check object a collection or delimited string of textarea names or id's (preferably names as they already exist in the pages) and have it spell check all of them, updating the text as spelling is corrected.

Share Improve this question asked Dec 21, 2009 at 15:59 BrettskiBrettski 20.1k17 gold badges77 silver badges101 bronze badges
Add a ment  | 

6 Answers 6

Reset to default 1

Check out using Google's api for this: http://www.asp101./articles/jeremy/googlespell/default.asp

Here is a free, open source Javascript library for spell checking that I authored:

https://github./LPology/Javascript-PHP-Spell-Checker

There's a link to a live demo at the top. It's designed to have the feel of a spell checker in a desktop word processor. I wrote it after being dissatisified with these same options.

To use, just include the JS and CSS files into your page, and then add this:

var checker = new sc.SpellChecker(
    button: 'spellcheck_button', // opens the spell checker when clicked
    textInput: 'text_box', // HTML field containing the text to spell check
    action: '/spellcheck.php' // URL of the server side script 
);

It includes a PHP script for spell checking, but it could be ported to another language fairly easily as long as it returns the correct JSON response.

If I were you, I'd look into something like aspell - this is used as one of the supported spellchecking backends in TinyMCE. Personally, I use pspell because it's integrated into PHP.

EDIT

There's an aspell integration here that has a PHP or a Perl/CGI version; might be worth checking out.

If I am not wrong, Firefox's English dictionary for spell checking takes around 800KB of data.

If you like to do everything in JavaScript -- for a full-featured spell checking engine, it means you need to load that 800KB data in every page load. It's really not a good idea.

So, instead of doing that in JavaScript, send the data to the server with AJAX, check it server side, and return it back; that's the best way.

Well this is quite old question, but my answer might help people who are looking for latest options on this question.

"JavaScript SpellCheck" is the industry leading spellchecker plugin for javascript. It allows the developer to easily add and control spellchecking in almost any HTML environment. You can install it in about 5 minutes by copying a folder into your website.

http://www.javascriptspellcheck./

Also support multiple languages - http://www.javascriptspellcheck./Internationalization_Demo

I might be a bit late on the answer to this question. I found a solution a long while ago. You must have a spell checker installed on your browser first. Then create a bookmark with the following code as the link.

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0
发布评论

评论列表(0)

  1. 暂无评论