     }
 
     /**
-     Initalises UIWebview.
-
-     */
-    fileprivate func initaliseLegacyWebView() {
-
-        self.legacyWebView = UIWebView(frame: self.view.bounds)
-        self.legacyWebView?.delegate = self
-        self.view = self.legacyWebView
-
-    }
-
-    /**
      Called if the user taps the cancel button.
      */
     @objc func closeView() {

}

/// The Web View Controller which encapsulates the management of the webivew and the interaction with the HPP web page.
class HPPViewController: UIViewController, WKNavigationDelegate,  WKUIDelegate, WKScriptMessageHandler, UIWebViewDelegate {

    @IBOutlet var containerView : UIView? = nil

    var webView: WKWebView?
    var legacyWebView: UIWebView?

    var delegate:HPPViewControllerDelegate?


     - parameter request: The network request to be loaded.
     */
    func loadRequest (_ request: URLRequest) {
        let session = URLSession.shared
        let dataTask = session.dataTask(with: request, completionHandler: { (data:Data?, response:URLResponse?, error:Error?) -> Void in

            if error != nil {
                UIApplication.shared.isNetworkActivityIndicatorVisible = false

                self.delegate?.HPPViewControllerFailedWithError!(error as NSError?)
                self.dismiss(animated: true, completion: nil)
            }
            else if data?.count == 0 {
                UIApplication.shared.isNetworkActivityIndicatorVisible = false

                self.delegate?.HPPViewControllerFailedWithError!(nil)
                self.dismiss(animated: true, completion: nil)
            }
            else {
                let htmlString = String(data: data!, encoding: String.Encoding.utf8)
                self.webView!.loadHTMLString(htmlString!, baseURL: request.url)

            }
        })
        dataTask.resume()
    }


