Get notified about a page change in UIWebView

前端 未结 2 1638
长发绾君心
长发绾君心 2020-12-30 06:53

I\'m curious if there\'s a way to detect a change of the displayed website inside a UIWebView. In an app I\'m working on we\'re using a UIWebView t

2条回答
  •  别那么骄傲
    2020-12-30 07:19

    in Swift 4

    func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
    
        if request.url?.absoluteString == "http://www.example.com/step3.htm" {
            // The user reached step 3!
        }
    
        return true
    }
    

提交回复
热议问题