Skip to content Skip to sidebar Skip to footer

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")
          returnNO;   //RestrictelsereturnYES;  //Allow
}

Post a Comment for "Ios Uiwebview - Restricting Html Path"