I have a webview in my project and I’m able to get it to load a webpage, but I want to be able to know when the page has finished loading.
I use the following to load the url
call method "URLWithString:" of class "NSURL" with parameter "http://www.urlgoeshere.com"
call method "requestWithURL:" of class "NSURLRequest" with parameter (result)
call method "loadRequest:" of (call method "mainFrame" of (view "TheWeb" of window "TheWindow")) with parameter (result)
I tried to do the following to see when the page is done loading, but it only will tell you if the page is done loading; if there is a embedded movie, swf, etc then the following will still say that its done loading
set isDoneLoadingPage to 1
repeat until isDoneLoadingPage is equal to 0
set isDoneLoadingPage to call method "isLoading" of (view "TheWeb" of window "TheWindow")
end repeat
log "Done Loading the Page"
I’ve been looking at the webview objective c methods and other info and I found this http://developer.apple.com/documentation/Cocoa/Reference/WebKit/Protocols/WebFrameLoadDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/webView:didFinishLoadForFrame:
According to the page, “This method is invoked when a location request for frame has successfully; that is, when all the resources are done loading.” Which I think is what I’m looking for, but I can’t seem to get it to work.
I’d appreciate any help on how to know when all of the resources of a webview page are done loading.
thanks