How do I determine if the web content has loaded?

Having problems with building or using the JCEF Java binding? Ask your questions here.

How do I determine if the web content has loaded?

Postby zhangyukun » Wed May 11, 2022 7:59 am

Hello, I use the JCEF CefBrowser to invoke the CEF services, and use the swing display web content.
I want to use CefBrowser.executeJavaScript to call some JS operations after the page is loaded to close the pop-up windows.How do I determine if the web content has loaded?
Code: Select all
        String url = "https://blog.csdn.net/knighthood2001/article/details/124618877";

        JBCefBrowser myBrowser = new JBCefBrowser(url);
        CefBrowser cefBrowser = myBrowser.getCefBrowser();
      // After the web content is loaded
        cefBrowser.executeJavaScript("alert('hello world!');",cefBrowser.getURL(), 0);
        cefBrowser.executeJavaScript(
                "window.onload = document.querySelector('.open-app-weixin')?.click();",
                cefBrowser.getURL(), 0);
        basePane.add(myBrowser.getComponent(), BorderLayout.CENTER);
zhangyukun
Newbie
 
Posts: 2
Joined: Wed May 11, 2022 7:51 am

Re: How do I determine if the web content has loaded?

Postby magreenblatt » Thu May 12, 2022 7:40 am

Methods are provided by CefLoadHandler.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 19 guests