Reputation: 325
I am using xml content to display in a webview.I am storing a xml content in string and giving it to html content like this.
NSString* string = [NSString stringWithFormat:@"<a id=\"2001\"><p>how to load the webview</p></a>",];
NSString* string1 = [NSString stringWithFormat:@"<a id=\"2002\"><p>load the webview</p></a>",];
static NSString *htmlTemplate = @"<!DOCTYPE html><html>"
"<head><title>nothing</title></head>"
"<body>"
"<p> %@ </p>"
"<p> %@ </p>"
"</body>"
"</html>";
NSString* r = [NSString stringWithFormat:htmlTemplate,string,string1];
and i am using a button if i click the button it needs to go 2002 tag how to do that .
Upvotes: 0
Views: 1596
Reputation: 412
Swift 3.0
aWebView.stringByEvaluatingJavaScript(from: "window.location.hash = 'Infrastructure'")
Upvotes: 0
Reputation: 385890
[webview stringByEvaluatingJavaScriptFromString:@"window.location.hash = '2002'"];
Upvotes: 1