Webkit caret color

Hi,


Can someone please advise how to change caret color of webview for iOS applications? I could find caret-color property which works on my mac book safari browser but it does not work on my iPhone 6+.


Thanks & Regards,

Deval

Replies

Awaiting answer 🙂

You can change that using CSS. Basically you would need to inject some CSS using javascript to your webview using stringByEvaluatingJavaScriptFromString

: on your webview.
Setting caret-color is currently busted on iOS. iOS doesn't update the color if the CSS changes while editing. It's so bad that if you set the caret-color to something different and switch to a different window, the caret-color can still be the same color that was set in the previous window. You can try it by going to the MDN page https://developer.mozilla.org/en-US/docs/Web/CSS/caret-color on iOS and trying the various examples to see that the caret color doesn't update most of the time.

It looks to be a deep Webkit bug https://bugs.webkit.org/show_bug.cgi?id=177489. I really wish Apple would fix this as it renders a standard CSS property useless.