如何使拼写检查在UIWebView上运行?

Ros*_*iak 7 spell-checking uiwebview ios

我正在尝试让UIWebView拼写检查一些可编辑的div(显示红色下划线).

let html = "<div id="content" spellcheck="true" contenteditable="true" style = 'width:200px;height:200px' Misspel</div>"    
self.messageWebView.loadHTMLString(html!, baseURL: nil)
Run Code Online (Sandbox Code Playgroud)

似乎没有用.但是我发现了一个奇怪的行为.如果我手动单击可编辑区域然后单击其他按钮以使div失去焦点,则会开始强调拼写错误的单词:

在此输入图像描述

我试过了

var mydiv = document.getElementById('content');
mydiv.focus();
setTimeout(function {....mydiv.blur();}, 1000);
Run Code Online (Sandbox Code Playgroud)

这不会触发拼写检查.只有手动点击某个元素才能使div失去焦点才能使其正常工作.我也试过WKWebVIew.不行.我在iPhone 6s上进行了测试,10.3.2任何想法都表示赞赏.