i have large .htm
file in main bundle wish load webview. no problem until append fragment id end of url. want webview open @ anchor id #c
on button press.
btw: if create url http://www.mydomain.com/database.htm#c , load internet. all good.
i have tried several approaches. both have failed. guessing server side parsing of url on internet, iphone not have capability. have suggestion? please explicit examples if possible. noob , on own.
stumped
nsstring *path = [[nsbundle mainbundle] pathforresource:@"database1.htm" oftype:nil]; nsstring *pathwithfrag = [nsstring stringwithformat:@"%@%@%",path, @"#c"]; nsurl *baseurl = [ nsurl fileurlwithpath:pathwithfrag]; [spinner2 loadrequest:[nsurlrequest requestwithurl:baseurl]]; [super viewdidload];
or
nsstring *path = [[nsbundle mainbundle] pathforresource:@"database1.htm" oftype:nil]; nsurl *baseurl = [ nsurl fileurlwithpath:path]; nsurl *newurl = [baseurl urlbyappendingpathcomponent:@"#c"]; [spinner2 loadrequest:[nsurlrequest requestwithurl:newurl]]; [super viewdidload];
it looks may issue nsurl url-escaping "#" character: http://9mmedia.com/blog/?p=299
following method on blog post, might work:
nsstring *path = [[nsbundle mainbundle] pathforresource:@"database1.htm" oftype:nil]; nsurl *baseurl = [nsurl fileurlwithpath:path]; nsurl *fullurl = [nsurl urlwithstring:@"#c" relativetourl:baseurl]; [spinner2 loadrequest:[nsurlrequest requestwithurl:fullurl]]; [super viewdidload];
Comments
Post a Comment