Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entirely blank screen on JavaScript based websites when rendered in JPanel #495

Open
felixlabrot opened this issue Jan 2, 2025 · 0 comments
Labels
bug Bug report

Comments

@felixlabrot
Copy link

Describe the bug
When attempting to open web pages which don't contain HTML and instead are fully based on JavaScript (Angular, Node.js, ... based sites) the entire screen is blank. JCEF does not show the website and not produce any log output.

To Reproduce
Open a website like https://klo.fyi/ or https://navi.graphhopper.org/ and observe a blank page.

Expected behavior
The websites should open and be usable and not freeze.

Versions (please complete the following information):

  • OS: Windows 10
  • Java Version: Oracle JDK 8u202
  • JCEF Version: 127.3.1
  • CEF Version: jcef-99c2f7a+cef-127.3.1+g6cbb30e+chromium-127.0.6533.100

Additional context
Does the problem reproduce with the JCEF simple or detailed sample application at the same version?
no

Does the problem reproduce with Google Chrome at the same version?
no

The following code is used and it follows exactly the Sample App. The only different thing is that it needs to render within a JPanel and not within a JFrame.

public class NavigationPanel extends JPanel {
    private static NavigationPanel INSTANCE;

    public static NavigationPanel getInstance() {
        if (INSTANCE == null)
            INSTANCE = new NavigationPanel();

        return INSTANCE;
    }

    private NavigationPanel() {
        setLayout(new GridLayout(1,1));

        Thread browserThread = new Thread("BrowserThread") {
            @Override
            public void run() {
                try {
                    CefAppBuilder builder = new CefAppBuilder();
                    CefSettings settings = builder.getCefSettings();
                    settings.windowless_rendering_enabled = false;
                    //settings.log_severity = CefSettings.LogSeverity.LOGSEVERITY_VERBOSE;
                    settings.root_cache_path = new File("jcef-cache").getAbsolutePath();

                    CefBrowser browser = builder.build().createClient().createBrowser("https://navi.graphhopper.org/", false, false);
                    NavigationPanel.this.add(browser.getUIComponent());
                } catch (CefInitializationException | UnsupportedPlatformException | IOException | InterruptedException ex) {
                    ex.printStackTrace();
                }
            }
        };

        browserThread.start();
    }
}

public class SampleApp extends JFrame {
    private SampleApp() {
        getContentPane().add(NavigationPanel.getInstance());
        setSize(800, 600);
        setVisible(true);
    }

    public static void main(String[] args) {
        new SampleApp();
    }
}
@felixlabrot felixlabrot added the bug Bug report label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

No branches or pull requests

1 participant