Bit of a confusing one and not sure where the solution (or problem) originates.
I am creating an iPad app using UIWebviews and Jquery Mobile. I am having to access my web resource over basic authentication. I have set up the UIWebview to correctly send my login credentials through the HTTP request and all the resources and those required by the page (CSS, Javascript etc) are loading correctly....
...except for those resources that are loaded dynamically via Javascript.
I am using Modernizr to load CSS files and JQuery to load a .JSON file and none of these are loaded when accessing my page via the webView. (when I access the page directly via Safari it works fine).
I am guessing therefore its an Xcode / iOS issue but I'm not sure where to start.
Any help / pointers would be great!
Answer can be found here: How to do authentication in UIWebView properly?
Quoting solution:
NSString* login = @"MYDOMAIN\\myname";
NSURLCredential *credential = [NSURLCredential credentialWithUser:login
password:@"mypassword"
persistence:NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:@"myhost"
port:80
protocol:@"http"
realm:@"myhost" // check your web site settigns or log messages of didReceiveAuthenticationChallenge
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace];
[protectionSpace release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With