Webview slow to load on device (grey loading screen)

I’m developing an app where users can swipe between webviews, which are all local htmls in the system.DocumentsDirectory. What I have now is three webviews, one to the left of the screen, one visible on the screen, and one to the right. The first issue is that loading them sometimes takes up to 3 seconds (probably averaging around 1 second). These are not extensive html documents at all, a few paragraphs and links is all. I can’t imagine why they take so long to load, and additionally there is a very ugly gray screen with a spinning gear when they are loading.

The second issue is that even when the left and right webviews are loaded, swiping them onto the screen causes the gray screen to flash, as if it is reloading the webview.

Is this an error on my implementation or a limitation of the platform/native? Is there anything I can do to remedy this issue?

Questions:

  1. What version of Corona are you using?

  2. Is this slowness in the simulator?

  3. If Yes to #2 Windows or OSX simulator?

4.If No to #2 What target device(s) are you running on that exhibit this issue?

  1. Would you be willing to share your project with the community to get help?  If so, you can zip it up and link it here.

  2. I don’t think loading web-views should be any slower than any other web content on the same device.  So, I do wonder if you’ve made a mistake.  You may need to get someone else to take a look (either via #5 above or possibly as a hit.)

  1. v2017.3068

  2. No slowness on simulator

  3. NA

  4. Happens on my iPhone 6s and is super bad on some Androids (not sure which ones, can ask testers)

  5. I’d rather not but I could isolate it in a small project and send that if that would help

Thanks!

Ok so I think I figured out part of the issue. I’m detecting swipes through a javascript function in the html files. However, the only way to communicate the swipe to the lua code is to load a url in the javascript (this will be picked up by the webView listener). I think in trying to load this url, the webView momentarily turns to the gray screen with the pinwheel.

Is there a way around this? I’ve looked everywhere for a way to detect swipes in the webView from Corona (not JS), but can’t find a way.

WebView is a native component so it sits above Corona.  Therefore interactivity is limited.

Questions:

  1. What version of Corona are you using?

  2. Is this slowness in the simulator?

  3. If Yes to #2 Windows or OSX simulator?

4.If No to #2 What target device(s) are you running on that exhibit this issue?

  1. Would you be willing to share your project with the community to get help?  If so, you can zip it up and link it here.

  2. I don’t think loading web-views should be any slower than any other web content on the same device.  So, I do wonder if you’ve made a mistake.  You may need to get someone else to take a look (either via #5 above or possibly as a hit.)

  1. v2017.3068

  2. No slowness on simulator

  3. NA

  4. Happens on my iPhone 6s and is super bad on some Androids (not sure which ones, can ask testers)

  5. I’d rather not but I could isolate it in a small project and send that if that would help

Thanks!

Ok so I think I figured out part of the issue. I’m detecting swipes through a javascript function in the html files. However, the only way to communicate the swipe to the lua code is to load a url in the javascript (this will be picked up by the webView listener). I think in trying to load this url, the webView momentarily turns to the gray screen with the pinwheel.

Is there a way around this? I’ve looked everywhere for a way to detect swipes in the webView from Corona (not JS), but can’t find a way.

WebView is a native component so it sits above Corona.  Therefore interactivity is limited.