Internet Explorer 10 内置了拼写检查器,并且运行良好。我尝试创建一个小型 HTML 页面来测试它,其中包含以下内容:
<!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>
所需要做的就是放置属性 spellcheck=true
和contentEditable=true
.
我还尝试添加 <meta http-equiv="X-UA-Compatible" content="IE=10" />
例如
<!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>
就此而言,使用 IE=edge 代替 IE=10 没有任何区别: What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?
然后我尝试将设置FEATURE_BROWSER_EMULATION添加到注册表: http://www.west-wind.com/weblog/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
这改进了某些具有 CSS 样式的元素的渲染,如 border-radius
所以至少我可以看到它处于 IE10 模式,但仍然没有拼写检查器。
以上页面可在 Internet Explorer 浏览器中运行,并且拼写检查功能正常。
但是,当相同的内容加载到TWebBrowser
时(我使用 TEmbeddedWB
但它只是同一个包装器)它不起作用。
经过一番谷歌搜索,仍然没有找到解决方案。你知道这在 WebBrowser 控件中是可能的吗?我需要适用于 Windows 7 而不仅仅是 Windows 8 的解决方案。我已经看到了注册表项 FEATURE_SPELLCHECKING,但它仅适用于 Windows 8。
是否有任何替代解决方案适用于 DesignMode
的TWebBrowser
控制?我正在寻找像 Word 或其他程序中那样的弯曲的红色下划线以及可能的 GUI 窗口来提供替代单词。
最佳答案
我认为你在这里运气不好。 Microsoft Connect 有一个错误报告关于 FEATURE_SPELLCHECKING 和 Windows 7。不幸的是,它已“按设计”关闭。
这是微软的官方答复:
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
关于delphi - TWebBrowser (TEmbeddedWB) 控件中的拼写检查器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19299326/