|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
For example: Web page code
Code: HTML/ASPX
<body>
<input type=file id="file">
<body>
VB code:This click event does not work
Code: Visual Basic.NET
Dim JsCode As String="document.getElementById('file').click();"
WebView1.EvalScript(JsCode)
|
|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
This example is also invalid
Code: Visual Basic.NET
Dim JsCode As String="document.getElementById('file').click();"
WebView1.GetDOMWindow.InvokeFunction("eval",JsCode)
This example can be
Code: Visual Basic.NET
WebView1.LoadUrl("JavaScript:document.getElementById('file').click();")
This is not Bug's EO.Webbrowser?
|
|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
This method is not.
Excuse me, what is the difference between WebView1.QueueScriptCall and WebView1.EvalScript?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
The above script doesn't do anything in Chromium V49, which is the version the current EO.WebBrowser is based on. It appears that this behavior was changed in newer versions. So we should have the same result the next time we sync to Chromium's codebase.
The primary difference between EvalScript and QueueScriptCall is EvalScript is synchronous, while QueueScriptCall is asynchronous.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
But it is possible to be directly on the web page. for example
Code: HTML/ASPX
<head>
<script type="text/javascript">
function abc(){
window.eval("document.getElementById(\"file\").click();");
}
</script>
</head>
<body>
<input type=file id="file" name=file>
<input type="button" value=openfile onclick="abc();" id="but1">
</body>
|
|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
I used to do the simulation page click on the software, if this step can not be the correct implementation of the trouble.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, This has to do with how Chrome verifies click event. Specifically for file input control, chrome check whether it is associated to a real mouse click or not (probably for security reasons). For example, while the following code works:
If you change it to:
Code: HTML/ASPX
onclick="setTimeout('abc()', 3000);"
Then it will not work. The later does not work because by the time "abc()" is called, there is no associated mouse click event since the original click event is long gone and this particular call is triggered by a timer. Chrome might have changed this in newer builds. In that case you will get the update when we update to the new engine. However we are not in a position make these kind of changes on our side since it can get out of control very quickly as Chrome is an extremely large project. Thanks!
|
|
Rank: Member Groups: Member
Joined: 12/10/2015 Posts: 17
|
thanks eo_support Now this is the only way to achieve this function.
Code: Visual Basic.NET
WebView1.LoadUrl("JavaScript:document.getElementById('file').click();")
|
|