views:

1549

answers:

1

[[webView mainFrame] loadHTMLString:html_string baseURL:[NSURL fileURLWithPath:@"/"]]; [[[webView mainFrame] webView] stringByEvaluatingJavaScriptFromString:test];

When I omit the second line which references a location.href = "#id" that so the webView will scroll to the appropriate line, the page loads fine. But when I include it and expect it to work, I only get a blank page.

Any suggestions?

+4  A: 

I suppose if the page is still loading setting the location would abort that. You could try waiting via the webView:didFinishLoadForFrame: delegate.

Tobias