Im taking over a project, and in this app the main goal here is to have a webview, and check every single page loads URL against a string check to determine which background functions need to take place.
Problem is, webViewDidFinishLoad only seems to fire once, when the webview itself is created. Anytime an internal link is clicked, it never fires again.
In onViewLoad i do have the delegate set to self, and by all means things are relatively in place, but again this is not being fired on each page load.
THIS SAID.
shouldStartLoadWithRequest DOES. BUT, because its STARTING the request, and the URL is not quite loaded in full by the time the event fires, it gets the current URL of the requesting page instead of the target URL when I use
NSString *curURL = [webView stringByEvaluatingJavaScriptFromString:@"window.location.href"];
The other functions either dont return anything or the exact same thing as the function above
//NSString *curURL = self.webView.request.URL.absoluteString;
//NSString *curURL = webView.request.mainDocumentURL.absoluteString;
So, im at a loss here, doing this on Android was relatively simple enough, but the limited amount of methods for the webView is making me depressed..
The problem was simply with the website using jQueryUI Mobile 1.0.4. This not only loads urls by appending a # with the next url in the mix,
http://url.com/somepage.php?item=1#/somepage.php?item=2
Also, doing this, somehow tricks the webView into thinking the page hanst changed despite changing the URL directly. So the webViewDidFinishLoad never fires after subsequent page loads with the library.
Sad. The library looked good too.