title: WKWebView is not scrolling the content to mapped HTML
body: <p>I am working on the WKWebView to render the HTML in WKWebView.</p>
  
  <pre><code>My HTML has &lt;a href ='#bottom'&gt;
  </code></pre>
  
  <p>This anchor tag will push my WKWebView to the content mapped to it.
  My full HTML  is :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;&lt;html lang="en"&gt;&lt;head&gt; &lt;title&gt;Hello&lt;/title&gt;&lt;style&gt;body{ font-size: 40px;}&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;a id='LnkTop'&gt;&lt;/a&gt;&lt;p&gt;&lt;a href='#bottom'&gt; Link 1&lt;/a&gt;&lt;/p&gt;&lt;div&gt;&lt;h3&gt;&lt;a id='top'&gt; Link 1 &lt;/a&gt;click will bring cursor here..&lt;/h3&gt;&lt;p&gt;HTML offers many of the conventional publishing idioms for rich text and structured documents, but what separates it from most other markup languages is its featuresfor hypertext and interactive documents. This section introduces the link (or hyperlink, or Web link), the basic hypertext construct.A link is a connection from one Web resource to another. Although a simple concept, the link has been one of the primary forces driving the success of the Web.A link has two ends -- called anchors -- and a direction. The link starts at the 'source' anchor and points to the 'destination' anchor,which may be any Web resource (e.g., an image, a video clip, a sound bite, a program, an HTML document, an element within an HTML document, etc.).&lt;/p&gt;&lt;/div&gt;&lt;div id='bottom'&gt;&lt;h3&gt;Link 2 click will bring cursor here..&lt;/h3&gt;&lt;p&gt;HTML offers many of the conventional publishing idioms for rich text and structured documents, but what separates it from most other markup languages is its featuresfor hypertext and interactive documents. This section introduces the link (or hyperlink, or Web link), the basic hypertext construct.A link is a connection from one Web resource to another. Although a simple concept, the link has been one of the primary forces driving the success of the Web.A link has two ends -- called anchors -- and a direction. The link starts at the 'source' anchor and points to the 'destination' anchor,which may be any Web resource (e.g., an image, a video clip, a sound bite, a program, an HTML document, an element within an HTML document, etc.).&lt;/p&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>My Code to handle the link button is as below:</p>
  
  <pre><code>func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) {
          print("Strat to load")
  
      }
      func webView(_ webView: WKWebView, shouldPreviewElement elementInfo: WKPreviewElementInfo) -&gt; Bool {
          print("Raghav")
          return true
      }
      func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
          print(error.localizedDescription)
      }
      func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
          print("Strat to load")
      }
      func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
          print("finish to load")
          webviewReportNotes.evaluateJavaScript("window.scrollTo(0,0)", completionHandler: nil)
      }
  
      func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
          print("error ")
          print(error)
      }
  
      func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -&gt; Void) {
          print("clicked")
          if navigationAction.navigationType == WKNavigationType.linkActivated  {
              print("cancel")
              ///webviewReportNotes.evaluateJavaScript("window.scrollTo(0,0)", completionHandler: nil)
              decisionHandler(.cancel)
              self.webviewReportNotes.allowsLinkPreview = true
             // webView.load(navigationAction.request)
          }
          else
          {
              print("allow")
              decisionHandler(.allow)
          }
      }
  
      func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
          print("comitted")
      }
      func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -&gt; WKWebView? {
          print("entered")
          if navigationAction.targetFrame == nil {
              webView.load(navigationAction.request)
          }
          return nil
  
      }
  </code></pre>
  
  <p>When click on the anchor tag it should scroll WKWebview to the content mapped to it in HTML which is not happening.</p>
  
  <pre><code>I am using Xcode 10 and working on iOS 11
  </code></pre>
  
  <p>I don't know what is missing I have tried almost everything but it is not scrolling to mapped data in anchor tag to have a view of HTML , you can paste my HTML in </p>
  
  <pre><code>https://codebeautify.org/htmlviewer/
  </code></pre>
  
  <p>Please check and let me know what am I missing.</p>
  
  <p>thank you in advance. :)</p>