iphone - UIWebView back button not getting enabled -
in application have uiwebview
in need add browser functionality(user can goback,forward or reload page). achieve have used code tutorial.
in code have 1 change in viewdidload
:
i loading data local html file this:
nsstring *htmlfile = [[nsbundle mainbundle] pathforresource:@"file name" oftype:@"html" indirectory:no]; nsdata *htmldata = [nsdata datawithcontentsoffile:htmlfile]; [self.webview loaddata:htmldata mimetype:@"text/html" textencodingname:@"utf-8" baseurl:[nsurl urlwithstring:@""]];
instead of:
nsurl* url = [nsurl urlwithstring:@"http://iosdeveloperzone.com"]; nsurlrequest* request = [nsurlrequest requestwithurl:url]; [self.webview loadrequest:request];
after loading initial html file if making click on page button should enabled, instead of getting enabled after second url click , not able go original home page.
please me this.
thanks.
i got answer. it's because load data webview
without loadrequest
. if load data
webview
string, won't have url
go or load old page. won't store data given webview
. that, need provide url
this.
[self.webview loadrequest:[nsurlrequest requestwithurl:[nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"file name" oftype:@"html"] isdirectory:no]]];
Comments
Post a Comment