I am using a cordova webview to load an html file that has a button that triggers shouldStartLoad event on click using js.
All is working fine excepts when no internet connection that when same button is pressed, shouldStartLoad event is not fired. I need to intercept that trigger in order to show a native alert but seems that nothing happens, if internet connection is available again, event is also fired again when click.
Console is not showing any info. How to intercept this state on cordova webview when no connection?
- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType;
If there is no internet connection and your pressing button to fire some event, check the
UIWebViewDelegatemethod calleddidFailWithError:and as you are using Phonegap, you can always check internet connection first by using Connection API before firing any load request: