IOS UIWebView - Restricting HTML Path
I have an UIWebview and it's loading a particular website section (news). And I want to block the users to access other part of the site, meaning they should only stay in the news
Solution 1:
To restrict the load of certain url do the following
webView.delegate = self;
And add the following function
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSString *urlString = [[request URL]absoluteString];
if(ulrString == @"restricted ur")
return NO; //Restrict
else
return YES; //Allow
}
Post a Comment for "IOS UIWebView - Restricting HTML Path"