问题
Internet Explorer 10 has built in spell checker and it works just fine. I tried to create a small HTML page to test it with following contents:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD>
<META name=GENERATOR content="MSHTML 10.00.9200.16721"></HEAD>
<BODY spellcheck=true contentEditable=true style="MARGIN: 0.5em">
<P>Theze ara mispeled wordz</P>
</BODY></HTML>
All that is needed is to put properties spellcheck=true
and contentEditable=true
.
I also tried adding <meta http-equiv="X-UA-Compatible" content="IE=10" />
e.g.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML lang=en xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><HEAD>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<META name=GENERATOR content="MSHTML 10.00.9200.16721"></HEAD>
<BODY spellcheck=true contentEditable=true style="MARGIN: 0.5em">
<P>Theze ara mispeled wordz</P>
</BODY></HTML>
For that matter, using IE=edge instead of IE=10 doesn't make any difference: What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?
I then tried adding setting FEATURE_BROWSER_EMULATION to registry: http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
This improved rendering of certain elements which had CSS styles like border-radius
so at least I could see it is in IE10 mode, but still no spell checker.
The above page works in Internet Explorer browser and spell check is working.
However, when same content is loaded into TWebBrowser
(I use TEmbeddedWB
but it is just the same wrapper anyway) it doesn't work.
After googling and googling for solutions, still haven't found one. Do you know is this even possible in WebBrowser control? I need the solution that would work on Windows 7 not just Windows 8. I've seen the registry entry FEATURE_SPELLCHECKING but it applies only to Windows 8.
Are there any alternative solutions that would work within DesignMode
of TWebBrowser
control? I am looking for curvy red underline thing like in Word or other programs and possible GUI window to offer alternative words.
回答1:
I think you are out of luck here. There was a bug report on Microsoft Connect concerning FEATURE_SPELLCHECKING and windows 7. Unfortunately it has been closed "as Designed".
This is the official answer from Microsoft:
Thank you for your feedback.
After additional review, the spelling feature is only supported on Windows 8 and higher and is not supported on Windows 7. This is because the spelling feature was built into the Windows 8 platform.
Best regards,
The Internet Explorer Team
回答2:
try to change it in the registry...
Bye Nicolas Perichon
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER) SOFTWARE Microsoft Internet Explorer Main FeatureControl FEATURE_BROWSER_EMULATION contoso.exe = (DWORD) 000090000
10001 (0x2711)Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive. 10000 (0x02710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
info de Microsoft: msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation
来源:https://stackoverflow.com/questions/19299326/spell-checker-in-twebbrowser-tembeddedwb-control