iPhone : load local html in uiwebview via javascript -
it's little bit confusing know let's try. have uiwebview in iphone app , it's loaded html local file bundel .. want put html button in file can load local file using javascript ... possible?? there other approach ..
any appreciated
you can custom protocol bridge between web page , app following :
in html page , may add following a
tag example :
<a href='tothepage2'>click here</a>
and in app you'll handle event following code :
webview.delegate = self; - (bool)webview:(uiwebview*)webview shouldstartloadwithrequest:(nsurlrequest*)request navigationtype:(uiwebviewnavigationtype)navigationtype { nsurl *url = request.url; nsstring *urlstring = url.absolutestring; if([urlstring isequaltostring:@"tothepage2"]) { [webview loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"thenexthtmlpage" oftype:@"html"]isdirectory:no]]]; return no; } return yes; }
Comments
Post a Comment