Wednesday, 24 October 2012

Open htaccess Password Protected Web-Page in UIWebView


In some cases we want to access a password protected (htaccess) webpage from UIWebView iPhone.
So for this we need add username and password between 'http://' and 'page url'. 
e.g. @"http://username:password@192.165.1.11/mypage"


NSString *url = @"http://username:password@192.165.1.11/mypage";
[webViewForhtaccessPageRendering loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: url]]];

here webViewForhtaccessPageRendering is UIWebVIew.

1 comment:

  1. Excellent, thanks ! This solution work with swift 2 too !

    ReplyDelete