Show loading message for web page in webView?

Is there a way to show a message somewhere while loading an external URL web page in the webView? Sometimes it takes longer for a site to load and the user only gets a grey screen.

Thanks,

Warren

Your best bet might be to display the splash screen while downloading the file in the background (e.g. to system.CachesDirectory).  Then once you know the file is present (from the listener function, phase==“ended”), then you can bring in the webview.

A second option might be to render the webview off-screen (e.g. x-coord to display.contentWidth*2), then move it on-screen when the download is complete.

Thanks. How would I know when the download is completed? I am using the webView.request method. I do not see any listener to know when it is complete.

A somewhat hidden feature … at the bottom of the newwebview page, you’ll see that you can add an event listener for “urlRequest”:

You may need to play around with it … there could be several phases to the urlRequest event, one of which should indicate that the file is downloaded (or complete or ended).

Check for event.type == “loaded”

http://docs.coronalabs.com/api/event/urlRequest/type.html

Your best bet might be to display the splash screen while downloading the file in the background (e.g. to system.CachesDirectory).  Then once you know the file is present (from the listener function, phase==“ended”), then you can bring in the webview.

A second option might be to render the webview off-screen (e.g. x-coord to display.contentWidth*2), then move it on-screen when the download is complete.

Thanks. How would I know when the download is completed? I am using the webView.request method. I do not see any listener to know when it is complete.

A somewhat hidden feature … at the bottom of the newwebview page, you’ll see that you can add an event listener for “urlRequest”:

You may need to play around with it … there could be several phases to the urlRequest event, one of which should indicate that the file is downloaded (or complete or ended).

Check for event.type == “loaded”

http://docs.coronalabs.com/api/event/urlRequest/type.html