How to tell the difference between an iframe loading vs. entire page loading in a UIWebView?

后端 未结 3 796
暖寄归人
暖寄归人 2021-02-04 09:18

In the [webView:shouldStartLoadWithRequest:navigationType:] event, how can you tell the difference between an iframe that\'s loading content vs. the entire page loading content?

3条回答
  •  一向
    一向 (楼主)
    2021-02-04 10:01

    I just used this method:

    Let the page load normally by returning YES in the [webView:shouldStartLoadWithRequest:navigationType:] event, and once it's done loading, see if the WebView's URL changed or not... if it did that means it was a page redirect if not it probably means it was an iframe that was loaded.

提交回复
热议问题