Exposing WKWebView#_loadAlternateHTMLString:baseURL:forUnreachableURL: would allow people to us show error messages in-content while maintaining a sane BackForwardList. The problem with the alternatives, loadHTML or loadRequest from an embedded HTTP Server, do not play well with the (read-only) BackForwardList. When presenting an error with loadHTML, it will *replace* the current page you are on. When presenting an error with loadRequest, either from embedded server or file: URL, it will generate a new entry in the BackForwardList that you cannot get rid of. The _loadAlternateHTMLString:baseURL:forUnreachableURL API seems to add the failing page to the BackForwardList while presenting alternative content, like an error message. This means a call to reloadFromOrigin will simply retry the page and leave the BackForwardList in a good state that makes sense.
Would you accept a patch for exposing this functionality? I'm happy work with the WebKit team to produce something.
<rdar://problem/21350071>