Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open url need username and password with uiwebview?

I want to open an URL which need password and username in a UIWebview. Such as open my local Wifi Router(192.168.1.1). But when I try following code, there is no popup as Safari to require password and username.

NSURL *url = [NSURL URLWithString:@"http://192.168.1.1"];
NSURLRequest *httpReq = [NSURLRequest requestWithURL:url];
[self._webView loadRequest:httpReq];

Since someone told me to use NSURLConnectionDelegate, I know this, but I donot know how to show the authorized page to the UIWebView.

like image 250
ZYiOS Avatar asked Aug 16 '11 02:08

ZYiOS


1 Answers

This will help

NSURL *url = [NSURL URLWithString:@"http://username:[email protected]"]; NSURLRequest *httpReq = [NSURLRequest requestWithURL:url]; [self._webView loadRequest:httpReq];

like image 106
kingemerald Avatar answered Oct 02 '22 13:10

kingemerald