In Safari, and in an NSTextView on OSX, search results can be highlighted with a bright yellow box that has a little animated pop. Is there any way to do this in a webview
The answer (as of 2013-05) seems to be that you have to highlight the find results in the webview manually (ref: "Implementing a Find menu item like Safari?" thread from 2011), although it's a long-planned webkit feature.
I'll list the links I found while researching this.
<span>
s to highlight the search terms.Take a look at this open source WebView subclass (MIT License) that incorporates NSTextFinder support:
https://github.com/shc-vj/SHCWebView
as well as the WebKit source itself for its MiniBrowser test app:
https://github.com/WebKit/webkit/blob/master/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
The MiniBrowser's window controller implements NSTextFinderBarContainer so it doesn't have to put its WebView inside an otherwise superfluous scrollview for the find bar to work.
I did find a way to do this.
See showFindIndicatorForRange:.