1

Our app has a UIWebView with an iFrame inside it, and the website the iframe points to requires basic authentication.

In a browser the alert popup displays and allows us to log in, however in the UIWebView it does not.

Is there a setting or something we've missed?

Chris

4

2 回答 2

2

As stated in the official Developer forums and as for now, UIWebView does not support authentication challenges in iOS. Please read here (requires developer account): UIWebView does not directly support authentication challenges

A workaround is to load the html in NSURLConnection (or NSURLSession), execute the authentication challenge and then assign the data the web view.

That won't work in all scenarios, though.

于 2013-11-12T14:45:38.690 回答
0

Some time iFrame URL try to load from the cache. Try to set the response header Cache-Control:no-cache. 401 Authorization requests will be blocked because of the cross-origin request

于 2020-09-04T20:27:10.490 回答