开发者

how to confine a UIWebView to a specific facebook user page

开发者 https://www.devze.com 2023-04-08 06:51 出处:网络
I\'m creating a UIWebView to load a facebook page of a specific: NSString *urlAddress = [NSString stringWithFormat:@\"http://www.facebook.com/%@\",self.userID];

I'm creating a UIWebView to load a facebook page of a specific:

NSString *urlAddress = [NSString stringWithFormat:@"http://www.facebook.com/%@",self.userID];

//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];

What I need to know is how to intercept the navigation of a UIWebView such that it only loads the url's of that specific user page. For instance, it would allow navigation in the Wall page, Info page and Photos page of that user ID.

I tried using the delegate method shouldStartLoadWithRequest:. It works well when the user clicks external links like Youtube or whatever, but this method is never called in case, say, the user clicks the facebook home button, which redirects to the home page of the logged in user who is not the corresponding user of the userID passed to the url.

An开发者_运维技巧y help? Thanks very much!


You should be able to use an NSURLProtocol to intercept the requests and filter only those that met the criteria for browsing.

http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSURLProtocol_Class/Reference/Reference.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号