UIWebView: webViewDidStartLoad/webViewDidFinishLoad delegate methods not called when loading certain URLs

前端 未结 3 1392
日久生厌
日久生厌 2021-02-04 05:06

I have basic web browser implemented using a UIWebView. I\'ve noticed that for some pages, none of the UIWebViewDelegate methods are called.

An

3条回答
  •  我寻月下人不归
    2021-02-04 05:19

    This isn't an iOS bug - the page isn't actually reloading. The UIWebView delegates are triggered following new page requests, but that page doesn't do that.

    Look very carefully at what happens in desktop Safari when you click the video link on that page as you describe. Make sure you pay attention to the address bar. The address will change, but critically the page will not reload.

    This is all handled by JavaScript, not by reloading the page. Simply put, the page never reloads, so there's no reason for the UIWebView delegates to be called.

    If you don't believe me, to conclusively prove this try repeating the steps you describe with JavaScript disabled. You'll notice the page behaves completely differently.

提交回复
热议问题