Android Question Webview - specific website not loading

GraemeW

Member
Licensed User
My app users click different buttons to load several websites using webview. However one particular site refuses to load 99 times out of 100 (oddly, sometimes it loads then subsequent loads fail). All other sites load as intended using the same code. Would anyone have any ideas why?

A test project with a good url and the bad url is attached.
 

Attachments

  • testwebview.zip
    51.9 KB · Views: 59
Solution
My app users click different buttons to load several websites using webview. However one particular site refuses to load 99 times out of 100 (oddly, sometimes it loads then subsequent loads fail). All other sites load as intended using the same code. Would anyone have any ideas why?

A test project with a good url and the bad url is attached.

You need to add usesCleartextTraffic into your manifest.

B4X:
SetApplicationAttribute(android:usesCleartextTraffic, "true")

drgottjr

Expert
Licensed User
Longtime User
there is an issue with the site's certificate:
SSL error: primary error: 3 certificate: Issued to: CN=www.ov.ingv.it,O=Istituto Nazionale di Geofisica e Vulcanologia,ST=Lazio,C=IT;
Issued by: CN=GEANT OV RSA CA 4,O=GEANT Vereniging,C=NL;
on URL: https://www.ov.ingv.it/index.php/monitoraggio-e-infrastrutture/bollettini-tutti/bollett-mensili-cf

webview seems to have a problem dealing with it (error 3 is a name mis-match). desktop chrome doesn't seem to care (it doesn't appear even to notice).
i instructed webview to log the error for me and ignore it, but it still won't load the page. there is also a secondary page that the site cannot load. webview is not a full browser. as google would put it, "that's all we know"
 
Upvote 0

GraemeW

Member
Licensed User
there is an issue with the site's certificate:
SSL error: primary error: 3 certificate: Issued to: CN=www.ov.ingv.it,O=Istituto Nazionale di Geofisica e Vulcanologia,ST=Lazio,C=IT;
Issued by: CN=GEANT OV RSA CA 4,O=GEANT Vereniging,C=NL;
on URL: https://www.ov.ingv.it/index.php/monitoraggio-e-infrastrutture/bollettini-tutti/bollett-mensili-cf

webview seems to have a problem dealing with it (error 3 is a name mis-match). desktop chrome doesn't seem to care (it doesn't appear even to notice).
i instructed webview to log the error for me and ignore it, but it still won't load the page. there is also a secondary page that the site cannot load. webview is not a full browser. as google would put it, "that's all we know"
Hmmm... thank you drgottjr for trying and reporting back...🙂

I couldn't work out how to log errors with webview. A site-specific error will be hard to solve..

Inspection of the page also shows:
1680152694907.png
1680152747164.png


I don't know what these mean but they also don't look good..😟
 
Upvote 0

teddybear

Well-Known Member
Licensed User
My app users click different buttons to load several websites using webview. However one particular site refuses to load 99 times out of 100 (oddly, sometimes it loads then subsequent loads fail). All other sites load as intended using the same code. Would anyone have any ideas why?

A test project with a good url and the bad url is attached.

You need to add usesCleartextTraffic into your manifest.

B4X:
SetApplicationAttribute(android:usesCleartextTraffic, "true")
 
Upvote 0
Solution

drgottjr

Expert
Licensed User
Longtime User
i changed my mind. i don't know what the problem is with your app, but if i load the url in a webview (in my own simple, test app), i have no problem. i have no experience with b4xpages, so i can't help. but the page works ok inspite of the errors we can see.
 

Attachments

  • capture1.png
    capture1.png
    60.6 KB · Views: 47
Upvote 0

GraemeW

Member
Licensed User
You need to add usesCleartextTraffic into your manifest.

B4X:
SetApplicationAttribute(android:usesCleartextTraffic, "true")
Thank you teddybear - that fixed it.

I already had a network-security-config which permitted specifc cleartext http domains but, on searching the page source, I found two more domains with http links. However after adding those to the permitted list the page still failed to load - so I suspect there are some mailto: domains that I'll have to check later. For now allowing everything through solves the problem. 🙂
 
Upvote 0

GraemeW

Member
Licensed User
i changed my mind. i don't know what the problem is with your app, but if i load the url in a webview (in my own simple, test app), i have no problem. i have no experience with b4xpages, so i can't help. but the page works ok inspite of the errors we can see.
Thanks drgottjr - I had found it worked on the first attempt for the day but failed on every subsequent attempt - weird.. However it looks like the problem was a couple of deeply embedded links to insecure domains that I had missed..
 
Upvote 0
Top