Disabling Firefox and Chrome spell checking in ifr

2019-03-01 06:26发布

问题:

There is a lot of info around about how to disable spell checking in html textarea element by using spellcheck='false'. However to have text area with more advanced capabilities, one must use iframe with designMode = "on" (see e.g. this page, this is a way that RichTextArea is implemented in GWT) and I couldn't find a single post on that topic.

It turns out that Firefox detects such advanced text areas and enables its spell checking in them. You can see it live by visiting this page from Firefox/Chrome and entering some content to text field. If you inspect html source code with e.g. Firebug, you'll see no textarea tag, yet FF spell checking is still active. The only way I managed to disable it was setting designMode to off but... I need it to be on.

The question is: Is there any possibility to disable FF spell checking for iframe-based text areas, without setting designMode = "off"?

回答1:

Just set spellcheck="false" onto the body element in the iframe. Works here in FF.