B4J Question Weird Webiew Problem With B4JPackager 11

keirS

Well-Known Member
Licensed User
Longtime User
I have an issue where a website wont display in a Webview when it is run from a .exe. It works fine in debug and release mode when run from the IDE but when it runs from a .exe it wont display the page.

I created a test program which traps Webengine errrors.

B4X:
Sub Class_Globals
    Private fx As JFX
    Private JOWebView As JavaObject
    Private WebView1 As WebView
    Private OAuthLogin As Form
    Private AuthCode As String = ""
    Private OAuthLoginResult As LoginResult
    Private LoginWWW As String
    Private JOWebEngine As JavaObject
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(ParentForm As Form,LoginPage As String)
  OAuthLogin.Initialize("Login",600,800)
  OAuthLogin.RootPane.LoadLayout("Login")
  OAuthLogin.SetOwner(ParentForm)
  OAuthLogin.Title = "OAuth Login"
  OAuthLogin.Resizable = False
  OAuthLogin.SetFormStyle("UTILITY")
  Log(LoginPage)
  LoginWWW = LoginPage
  JOWebView = WebView1
  OAuthLoginResult.Initialize
 
   'Add listener to Webengine Exception Poperty
   
   JOWebEngine = JOWebView.RunMethodJO("getEngine",Null).RunMethodJO("getLoadWorker",Null)
   Dim o As Object = JOWebEngine.CreateEvent("javafx.beans.value.ChangeListener","webengine",False)
   JOWebEngine.RunMethodJO("exceptionProperty",Null).RunMethod("addListener",Array(o))
End Sub
Public Sub ShowLogin() As ResumableSub
   
    WebView1.LoadUrl(LoginWWW)
    Wait For WebView1_PageFinished
    OAuthLogin.ShowAndWait
    If AuthCode.Length > 0 Then
   
        OAuthLoginResult.AuthCode = AuthCode
        Return  OAuthLoginResult
    Else
        Return ""
    End If
   
   
End Sub
'Handle webengine exceptions and load error page
Sub webengine_Event(MethodName As String, Args() As Object)' ignore the arguments
    Dim JO As JavaObject
    JO = Args(2)
    Log("Webengine Failed: " & JO.RunMethod("getMessage",Null))
    WebView1.LoadHtml("Webengine Failed: " & JO.RunMethod("getMessage",Null))
   
   
End Sub
Sub WebView1_LocationChanged (Location As String)
 
   
   
   
End Sub
Sub WebView1_PageFinished (Url As String)
   
End Sub
Sub SetLoginPage(WWWPAge As String)
    LoginWWW = WWWPAge
End Sub

And I get the following result:

Capture.png


I cant post the link to the actual page because it's an OAuth 2 landing page so the link has my Client Id in it. But the link in the attached test project causes the same issue. It shows this page when run from the IDE:

Capture2.png
 

Attachments

  • webvwtest.zip
    4.3 KB · Views: 190
Top