B4J Question [ Webview Problem ] html form dont send parameter on B4J webview

Waldemar Lima

Well-Known Member
Licensed User
Hello Everyone, i am using webview on b4J and i tested this same code on B4A and on android it works well ... but on B4J no, there is something I can make it work? follow the code below:

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private WebView1 As WebView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    
    Dim we,wvjo As JavaObject
    we.InitializeNewInstance("javafx.scene.web.WebEngine",Null)
    wvjo = WebView1
    we = wvjo.RunMethod("getEngine",Null)
    Dim useragent As String=$"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"$
    we.RunMethod("setUserAgent",Array(useragent))
    'WebView1.LoadUrl("http://www.whoishostingthis.com/tools/user-agent/")
    
    WebView1.LoadHtml($"
    
    <!DOCTYPE html>
    <html>
    <body>
    
    <h1>The form method="post" attribute</h1>
    
    <form action="https://mylink.com" method="post">
      <input type="hidden" id="parameter1" name="parameter1" value="Testing">
      <input type="submit" value="Submit">
    </form>
  
    </body>
    </html>
    
    "$)
    
End Sub


when i click on " submit " on webview html ( B4J ) i get this below :
1609933473181.png ( as if the parameter1 parameter was not sent)

when i click on " submit " on webview html ( B4A ) i get this below :
1609933581006.png
 

Waldemar Lima

Well-Known Member
Licensed User
There is not enough information here. Are you trying to access a specific site? Why do you need to start with LoadHtml?

because this particular section in javascript can only be executed in the domain of origin , to maintain security
 
Upvote 0
Top