Results 1 to 25 of 25

Thread: WebBrowser not loading phpmyadmin

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Unhappy WebBrowser not loading phpmyadmin

    Hey! I'm trying to load on the WebBrowser a phpmyadmin website, but it's loading only half...
    Name:  asd.jpg
Views: 522
Size:  4.9 KB
    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?

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    Re: WebBrowser not loading phpmyadmin

    What happens if you replace the WebBrowser control with the WebView2 control? Does it do the same thing?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: WebBrowser not loading phpmyadmin

    It does work with WebView2. Can't I solve it without any external libraries?

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    Re: WebBrowser not loading phpmyadmin

    As far as I am aware, the WebView2 is not an external library.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Unhappy 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.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    Re: WebBrowser not loading phpmyadmin

    Can you please provide the relevant code?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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.

  8. #8
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  9. #9

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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.

  10. #10
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    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);
    ")
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  11. #11

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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

  12. #12
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  13. #13

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: WebBrowser not loading phpmyadmin

    Attachment 185100
    I think thats what you talking about.

  14. #14
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  15. #15
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    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

  16. #16

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: WebBrowser not loading phpmyadmin


  17. #17
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    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?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  18. #18

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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

  19. #19
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: WebBrowser not loading phpmyadmin

    Quote Originally Posted by Daveeed View Post
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  20. #20

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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 ..

  21. #21
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,762

    Re: WebBrowser not loading phpmyadmin

    This sounds like a compatibility issue. What OS are the three machines?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  22. #22

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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?

  23. #23
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: WebBrowser not loading phpmyadmin

    Can you open it using a browser like chrome, Edge, firefox?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  24. #24

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    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.

  25. #25

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    61

    Re: WebBrowser not loading phpmyadmin

    Any ideas somebody?

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
  •  



Click Here to Expand Forum to Full Width