-
Jun 10th, 2022, 03:12 PM
#1
Thread Starter
Member
WebBrowser not loading phpmyadmin
Hey! I'm trying to load on the WebBrowser a phpmyadmin website, but it's loading only half...
I set the IE version of the app to 11, and tried to load the same site on IE and Edge, both do load it correctly, only the WebBrowser doesn't. Any ideas, suggestions?
-
Jun 10th, 2022, 03:41 PM
#2
Re: WebBrowser not loading phpmyadmin
What happens if you replace the WebBrowser control with the WebView2 control? Does it do the same thing?
-
Jun 11th, 2022, 09:24 AM
#3
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
It does work with WebView2. Can't I solve it without any external libraries?
-
Jun 11th, 2022, 12:25 PM
#4
Re: WebBrowser not loading phpmyadmin
As far as I am aware, the WebView2 is not an external library.
-
Jun 12th, 2022, 06:10 AM
#5
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
Okay, then I will use it, but now comes another problem. On the PC where I have the VS, the WebView2 loads correctly, everything s fine, but when I come to test it on 2 other devices, the WebView2 is blank white. Any ideas?
*Edit: the Webview2_NavigationCompleted doesn't get called on the other devices.
Last edited by Daveeed; Jun 12th, 2022 at 06:16 AM.
-
Jun 12th, 2022, 11:07 AM
#6
Re: WebBrowser not loading phpmyadmin
Can you please provide the relevant code?
-
Jun 12th, 2022, 01:08 PM
#7
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
It doesn't have any relevant code, I just set the source to the Phpmyadmin site, and called an Msgbox to check if the Webview2_NavigationCompleted was called..
The one that is not on default, it's docked to the center screen.
-
Jun 12th, 2022, 04:14 PM
#8
Re: WebBrowser not loading phpmyadmin
That sounds as if there is code to share. If you are unwilling to share it then I understand, but please understand that I cannot be of much help without it.
-
Jun 13th, 2022, 02:51 AM
#9
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
I'll try to show you anything may related to this.
Code:
Private Sub TabPage2_Enter(sender As Object, e As EventArgs) Handles TabPage2.Enter
Me.WindowState = FormWindowState.Maximized
WebView21.Source = New Uri("http://217.144.54.31/phpmyadmin/")
'WebView21.ExecuteScriptAsync("document.getElementById('input_username').value = '-'")
'WebView21.ExecuteScriptAsync("document.getElementById('input_password').value ='-'")
'WebView21.ExecuteScriptAsync("document.getElementById('input_go').click()")
End Sub
Private Sub WebView21_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs) Handles WebView21.NavigationCompleted
MsgBox("Completed!")
End Sub
https://imgur.com/a/uJFnw7o
Hope it helps you, I have no more ideas..
Last edited by Daveeed; Jun 15th, 2022 at 08:07 AM.
-
Jun 13th, 2022, 08:34 AM
#10
Re: WebBrowser not loading phpmyadmin
I would first suggest removing the source from the property window in the designer view and then swap this line out with the Navigate method (documentation):
Code:
' replace
WebView21.Source = New Uri("http://217.144.54.31/phpmyadmin/")
' with
WebView21.Navigate(New Uri("http://217.144.54.31/phpmyadmin/"))
My second suggestion is to try another event, perhaps the DOMContentLoaded event (documentation):
Code:
Private Sub WebView21_DOMContentLoaded(sender As Object, e As CoreWebView2DOMContentLoadedEventArgs) Handles WebView21.DOMContentLoaded
MessageBox.Show("The initial HTML document has been parsed.")
End Sub
If neither of those two suggestions work, then you could go nuclear and try to bind the event handler using JavaScript if all you are trying to set are some input values:
Code:
WebView21.Source = New Uri("http://217.144.54.31/phpmyadmin/")
WebView21.ExecuteScriptAsync("
window.addEventListener('load', () => {
document.getElementById('input_username').value = 'root';
document.getElementById('input_password').value = 'SocialRP95'
document.getElementById('input_go').click();
}, false);
")
-
Jun 13th, 2022, 09:13 AM
#11
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
Firstly, I don't have a function like WebView21.Navigate(New Uri("http://217.144.54.31/phpmyadmin/")), only WebView21.NavigateToString()
Secondly, I neither have WebView21.DOMContentLoaded event.. Should this be the problem?
Attachment 185099
-
Jun 13th, 2022, 01:09 PM
#12
Re: WebBrowser not loading phpmyadmin
Which version of the WebView are you using? You can verify by going to the solution explorer, expanding References, selecting the WebView library, and then inspecting the properties.
-
Jun 13th, 2022, 02:04 PM
#13
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
Attachment 185100
I think thats what you talking about.
-
Jun 13th, 2022, 04:03 PM
#14
Re: WebBrowser not loading phpmyadmin
I'm sorry, but it is not showing up on my end. Something funky is going on with VBForums and images.
Try uploading the image to an external host and then use [img]www.mytemporaryurl.com/my-image-specific-url[/img]. That's the only way I can get images to work on VBForums now.
-
Jun 13th, 2022, 05:30 PM
#15
Re: WebBrowser not loading phpmyadmin
There is actually an issue with attachments on the forum at the moment.
If you use the features in the "Quick Reply" area they don't attach properly, but you can add attachments via "Go Advanced" and then "Manage Attachments".
More info (and tests) here: https://www.vbforums.com/showthread....ttachment-Test
-
Jun 14th, 2022, 02:56 AM
#16
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
-
Jun 14th, 2022, 08:02 AM
#17
Re: WebBrowser not loading phpmyadmin
OK, looking at the documentation a bit more it appears as though those events are not exposed in Microsoft.Web.WebView2.WinForms but they are in Microsoft.Web.WebView2.Core.
What happens if you bind the window's load event using JavaScript and set the values in the event handler?
-
Jun 15th, 2022, 08:48 AM
#18
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
In my first PC it does load the page, but doesn't set the inputs. In the other devices, it doesn't even load the page..
Code:
Private Sub TabPage2_Enter(sender As Object, e As EventArgs) Handles TabPage2.Enter
Me.WindowState = FormWindowState.Maximized
WebView21.Source = New Uri("http://217.144.54.31/phpmyadmin/")
WebView21.ExecuteScriptAsync("
window.addEventListener('load', () => {
document.getElementById('input_username').value = '';
document.getElementById('input_password').value = '-'
document.getElementById('input_go').click();
}, false);"
)
End Sub
-
Jun 15th, 2022, 09:06 AM
#19
Re: WebBrowser not loading phpmyadmin
Originally Posted by Daveeed
In my first PC it does load the page, but doesn't set the inputs. In the other devices, it doesn't even load the page..
Code:
Private Sub TabPage2_Enter(sender As Object, e As EventArgs) Handles TabPage2.Enter
Me.WindowState = FormWindowState.Maximized
WebView21.Source = New Uri("http://217.144.54.31/phpmyadmin/")
WebView21.ExecuteScriptAsync("
window.addEventListener('load', () => {
document.getElementById('input_username').value = '';
document.getElementById('input_password').value = '-'
document.getElementById('input_go').click();
}, false);"
)
End Sub
Not sure why it would set the inputs...
It looks like it is clearing them... not setting them.
Code:
document.getElementById('input_username').value = '';
document.getElementById('input_password').value = '-'
-tg
-
Jun 15th, 2022, 10:47 AM
#20
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
I've just removed the credentials. But the problem starts that the website is not loading even with that part commented ..
-
Jun 15th, 2022, 12:59 PM
#21
Re: WebBrowser not loading phpmyadmin
This sounds like a compatibility issue. What OS are the three machines?
-
Jun 15th, 2022, 01:56 PM
#22
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
Every machine has Windows 10. Maybe there are some essential libraries, or dependencies which are needed to run the WebView2 control?
-
Jun 15th, 2022, 02:41 PM
#23
Re: WebBrowser not loading phpmyadmin
Can you open it using a browser like chrome, Edge, firefox?
-tg
-
Jun 16th, 2022, 01:57 PM
#24
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
The website? Yeah, sure, I can, with chrome and edge too.
Last edited by Daveeed; Jun 19th, 2022 at 07:06 AM.
-
Jun 19th, 2022, 07:07 AM
#25
Thread Starter
Member
Re: WebBrowser not loading phpmyadmin
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|