Hi, I have a UIWebView, Ive inserted a html with a onclick to handle the action in my function.
When I click in div tag, I handle the action here:
The problem is nothing happends when I click. If i click for a little seconds in div tag it appears a little window entitled "Action".
But if I put:
[webView loadHTMLString:HTMLData baseURL:nil];
It works fine, I receive the call and I handle action in my method, its correct, but I need to load local files in html so I put;
[webView loadHTMLString:HTMLData baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]]];
When I do this dont works onclick and it appears me the window "Action".
Any idea? Thanks for you help
Code:
NSString *HTMLData = @"
<div onclick='window.location=\"call?my_function\"'>Test</div>
<h1>Hello this is a test</h1>
<img src="sample.jpg" alt="" width="100" height="100" />";
[webView loadHTMLString:HTMLData baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]]];
When I click in div tag, I handle the action here:
Code:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
.....
[self test];
return YES;
}
-(void) test {
NSLog(@"Test");
}
The problem is nothing happends when I click. If i click for a little seconds in div tag it appears a little window entitled "Action".
But if I put:
[webView loadHTMLString:HTMLData baseURL:nil];
It works fine, I receive the call and I handle action in my method, its correct, but I need to load local files in html so I put;
[webView loadHTMLString:HTMLData baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] resourcePath]]];
When I do this dont works onclick and it appears me the window "Action".
Any idea? Thanks for you help