Given a local URL address like index.html
Now I need to use UIWebView
to load it in iPad. I followed these steps:
Create NSURL
<
For swift 3 solution1: You can call this line after webview loaded
webView.stringByEvaluatingJavaScript(fromString: "window.location.href = '#myHashtag'")
solution2: also if you want to load directly use this
webView1.loadRequest(URLRequest(url: URL(string: url! + "#myHashtag")!))
ObjC: solution 1:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[webView stringByEvaluatingJavaScriptFromString:@"window.location.href = '#myHashtag';"]; }
solution2:
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat: @"%@#myHashtag",myURL]]]];