title: Never ending loop while loading HTML in Web View
body: <p>I try to load webView with existing website.</p>
  
  <p>I added buttons on a navigation bar which have url links:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      webView.delegate = self
  
  
      var myHTMLString = ""
      guard let myURL = URL(string: domainURLString) else {
          print("Error: \(domainURLString) doesn't seem to be a valid URL")
          return
      }
  
      do {
          myHTMLString = try String(contentsOf: myURL, encoding: .utf8)
      } catch let error {
          print("Error: \(error)")
      }
      webView.frame = view.bounds
      webView.scalesPageToFit = true
  
      createBottomNavigationBar()
  
  
      webView.loadHTMLString(myHTMLString as String, baseURL: nil)
  
  }
  
  
  
  
  func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -&gt; Bool {
  
      print("===============================start===============================")
  
      let myURLString:String = (request.url?.absoluteString)!
  
      var myHTMLString = ""
  
      if navigationType == UIWebViewNavigationType.linkClicked {
          print("link clicked")
  
          webView.stopLoading()
  
          var myHTMLString = ""
          let myURL = URL(string: myURLString)
          do {
              myHTMLString = try String(contentsOf: myURL!, encoding: .utf8)
          } catch let error {
              print("Error: \(error)")
              return true
          }
  
          webView.loadHTMLString(myHTMLString as String, baseURL: nil)
  
          print("first")
          print(request.url)
  
  
      }else if(navigationType == UIWebViewNavigationType.other){
          print("This is for Navigation Button click")
          //webView.loadHTMLString(myHTMLString as String, baseURL: nil)
      }
      else{
          print("else")
      }
      return true
  </code></pre>
  
  <p>However, When I uncomment </p>
  
  <pre><code>webView.loadHTMLString(myHTMLString as String, baseURL: nil)
  </code></pre>
  
  <p>in this statement:</p>
  
  <pre><code>}else if(navigationType == UIWebViewNavigationType.other){
  </code></pre>
  
  <p>the app loops forever. </p>
  
  <p>The statement is for when one of the navigation buttons click fires. It redirects to internal url like "<a href="http://yahoo.com/mail" rel="nofollow noreferrer">http://yahoo.com/mail</a>".</p>