简体   繁体   中英

Using baseurl in UIWebView

I have some issues loading a site that apparently has to do with needing to properly set a baseurl. The main site is http://www.oklahomachristianacademy.org and the site address I need to have open is a string that returns as

applewebdata://F6224B10-25ED...

So, in my code I thought this would work to set the baseurl and the string attached above to load into the app.

-(void)viewWillAppear:(BOOL)animated {
NSURL *theurl = [NSURL URLWithString:@"http://www.oklahomachristianacademy.org/"];
[savedweb loadHTMLString:(NSString *)link baseURL:(NSURL *)theurl];
}

However, this does not work, and the UIWebview simply displays the applewebdata:// line again. What am I missing?

use this code

//NSString *urlAddress = @"http://www.google.com";
NSString *urlAddress = @"http://cagt.bu.edu/page/IPhone-summer2010-wiki_problemsandsolutions";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView.
[webView loadRequest:requestObj];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM