I want to access/clear the back forward list as if the UIWebView is new again. Is there any public API or workaround to do this?
I\'ve tried:
I was successful (as far as you can call such a workaround 'successful') using the following line of code:
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"if( window.history.length > 1 ) { window.history.go( -( window.history.length - 1 ) ) }; window.setTimeout( \"window.location.replace( '%@' )\", 300 );", targetLocation]];
where targetLocation is the desired URL as a NSString.
What it does is to tell the browser to go as far backwards as the history goes and then, after a short timeout, load the desired URL.
This of course does not solve the problem of clearing the forward going history (which I didn't need in my case).