0

My app loads up a json feed and a webview, the url of the webview is taken from the webview. I cannot show anything until both of these are loaded, therefore I am using a splash screen. My problem is that my webview connects to a socket.io server using XHR-Long Polling. Therefore, my webview thinks that it is still loading data, and never fires the onPageFinished event, which is where I was previously dismissing my dialog, before I added socket.io. This means that the splash screen never dismisses.

Where can I put my .dismiss() so that it only dismisses once everything is loaded? Is there anything I can do to make the webview think it has loaded the page? My question is basically, what is the best way to handle this?

Thanks

SteveEdson
  • 2,485
  • 2
  • 28
  • 46

1 Answers1

1

you can bind your Android dismiss() to the WebView's Javascript interface, then call it from Javascript code running in the WebView (e.g. in your XHR callback).

Check this out : http://developer.android.com/guide/webapps/webview.html#UsingJavaScript

Regards, Patrick.

Patrick Decat
  • 618
  • 5
  • 11
  • Sorry for the late reply. This is not an ideal solution as it would depend on JavaScript for every page. I would like a solution that would work regardless of the webpage contents. Thank you for your help though. – SteveEdson Dec 20 '12 at 10:21