Which methods and class will be invoke when reload a webpage or open a new webpage in safari
Question
As we know , When we load frame from webpage of safari, we will invoke the delegate methods of webkit informal protocol(WebFrameLoadDelegate):
webView:didStartProvisionalLoadForFrame:
webView:didChangeLocationWithinPageForFrame:
But I want to know whick class and methods will be invoked when reload a webpage or open a new webpage in safari ? Thank you very much!
Solution
The same delegates are called, you just need to check that the webFrame that is sending this delegate message is the mainFrame by checking that it has no parent. For example:
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
if(![frame parentFrame]) {
// There is no parent frame so this is the main frame.
}
// other actions for child frames.
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow