Android Question WebView, local html + javascript and the Websocket connection is not working

Kuba_B4x

New Member
Licensed User
Hi All
I am trying to make a very simple application that only runs a website in WebView from a local html file in the DirAssets directory. The website contains javascripts that work in my application, except for the Websocket connection options. All scripts from the file work correctly (including Websocket connection support) in Edge and Brave browsers on Windows10 and when I run the html file on a Samsung Galaxy S10e phone in Chome or Samsung Internet browser.
The html file in my B4A program is loaded with the option:

code:
Sub Activity_Create (FirstTime As Boolean)
  Activity.LoadLayout ("Main")
  WebView1.Initialize ("webView1")
  Activity.AddView (WebView1, 0, 0, 100% X, 100% Y)
  WebView1.loadhtml (File.ReadString (File.DirAssets, "1.html"))
End Sub

Has anyone encountered the problem of Websocket not working via WebWiew? Why don't I write a "regular" application but use the file from the website? Therefore, because the file is already there and it will mainly be updated, and I do not want to modify the program code. I would be grateful for your suggestions.
 
Top