How to load “HTTPS” url in the UIWebView?


Hi guys,

Here, in this post, I am going to teach you the way to load the “https:” url in the UIWebView.

Loading a “https” url in UIWebview in different from loading the normal “http” url.”http” urls are very prone to cyber attacks. Hackers can easily hack the data you are communicating with the websites. Thats the reason why many banking sites are “https”. “https” is the secured way of communicating with the websites.

To load normal url on webview, you sav

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@”http://somewebsite”%5D%5D;

[webViewObject loadRequest:request];

This will load properly with out any error.But when it comes to https website then UIWebView will not work. There are few steps you required to achieve this

Step 1:

Create an drag & drop UIWebView in the xib/ storyboard onto a ViewController and connect with IBOutlet of UIWebView object in ViewController.h file.

Step 2: set webView.delegate =self;

& copy UIWebView delegates into .m file and write modify the delegates in the following way.

Here, isDone  flag is used to check if authentication is received or not. if isDone is “YES” then authentication is received. 

Step 3:

This authentication is received in the NSUrlConnectionDelegates. To do that, implement in the following way

Now, if you run the application, then you can see “https” website getting loaded in your UIWebView. 🙂

Customize this code to match your requirements

Happy Coding.

2 Responses to How to load “HTTPS” url in the UIWebView?

  1. Ritesh Chopra says:

    Perfect Answer….. Thanks Buddy… You saved my life……

  2. Matt Byers says:

    any chance you could leave a zip of the code or have a download of a working project…I couldn’t seem to get it to work but I am a noob

Leave a comment