How do you load a secured webpage? CSS/JS not displayed.

Discussion in 'iOS Programming' started by TurboLag, Mar 18, 2009.

  1. TurboLag macrumors member

    Feb 24, 2004
    I have a website I need to access which requires authentication, which I have accomplished using NSURLConnection, and implementing didReceiveAuthenticationChallenge delegate method. When I try to display the page which requires authentication, all I see is text on a white background, no images or CSS content. The following code snippet is in connectionDidFinishLaunching, where receivedData is the NSMutableData returned from the NSURLConnection.

    [webView loadData:(NSData  *) receivedData MIMEType:@"text/html"textEncodingName:@"UTF-8"baseURL:[ NSURLURLWithString:@"" ]];  

    Has anyone successfully implemented a webview which can display websites that require authentication?

    If I try to reload the same page within the connectionDidFinishLoading, I can see static images, but no dynamic content.
    NSURL *url = [NSURL URLWithString:URLString];
    	NSURLRequest *request = [NSURLRequest requestWithURL:url];
    	[webView loadRequest:request];
    The webpage appears as expected in mobile Safari.
  2. Str3tch76 macrumors newbie

    Jul 24, 2012
    Hey - I know this is a few years old, but did you ever figure out how to do this? I have exactly the same issue. A common scenario I think, I'm surprised there's no answers.

Share This Page