4

I have a webView which will display the https url. I am trying to open a https url which will provide a authentication dialog like this http://members.easynews.com/ . In Mac, it is opening as dialog box, even in iPhone safari browser it is displaying as dialog box. But in webview , it is not displaying the dialog box. How to display that dialog box in webView ??

Cyril
  • 1,216
  • 3
  • 19
  • 40

1 Answers1

4

I think it is because of some firewall settings by that link authorities.thats why they are asking for authorisation.i am trying to load that in my webview i wont get anything .it is not loading

go for this

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://members.easynews.com"]];  

instead of loading it in to webview or else are loading i this manner

  - (void)viewDidLoad {
     [super viewDidLoad];
    webView.delegate = self;
      NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; 
      NSURLRequest *request = [NSURLRequest requestWithURL:url]; 
      [webView setScalesPageToFit:YES];         
      [self.webView loadRequest:request];               
    }

add this new method in your class

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
   NSLog("Error : %@",error);
}

I hope you have connected webView object with its outlet in Interface builder?

Muhammad Adnan
  • 2,668
  • 15
  • 27
hacker
  • 8,919
  • 12
  • 62
  • 108
  • ya for me too. But it is loading perfectly in the iPhone safari browser – Cyril May 29 '12 at 10:06
  • go for what i had did it in my answer without webview in your button action.it is directly loading from safari – hacker May 29 '12 at 10:18
  • Yep . It is opening the url in the Safari Browser. But I don't to suspend my app and open in another app. I wish to open in my WebView itself. Any help ? – Cyril May 29 '12 at 10:42
  • No its not like that Your app is in the background.it is there in the same state as it before but other than this i dnt know how can because they are restricting the usage of that site with some firewalls. – hacker May 29 '12 at 10:44
  • I think I am locked out. Is there any property we can set for UIWebView so that it will display those dialog box ? – Cyril May 29 '12 at 10:50
  • try with my edit in the answer, is webView is declared as property? if not then instead of using [self.webView loadRequest:request]; use [webView loadRequest:request]; this.(remove self. from self.webView) – hacker May 29 '12 at 11:27
  • Yes sir. Everything seems to right. I have written all those code. Still I can't find breakthrough. I wonder how the webview disables the authentication dialog. Please please tell me some way. I am getting mad. – Cyril May 29 '12 at 12:26
  • R u getting anything loading the url? – hacker May 29 '12 at 12:31
  • No. The network activity indicator is keep on running in the Top status bar. The url is not loading. – Cyril May 29 '12 at 12:36
  • I have found one link , a same kind of problem a user is facing. But there is no answer. FYI. http://www.iphonedevsdk.com/forum/iphone-sdk-development/45447-uiwebview-doesnt-allow-login-dialog.html – Cyril May 29 '12 at 12:37
  • 1
    go for this link this is your answer.You have to implement the authentication Yourself http://stackoverflow.com/questions/1769888/how-to-display-the-authentication-challenge-in-uiwebview – hacker May 29 '12 at 12:44
  • is it make away Your problems – hacker May 29 '12 at 15:24
  • Ya. I have tried. It went to infinite loop. Even I fixed it , it is not working :( . – Cyril May 29 '12 at 15:32