How do I load html?

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

How do I load html?

Postby kareed » Sat Mar 04, 2017 2:01 am

Hi,
I am trying to load html and can't seem to get it to work. I am trying the code below and nothing shows up in the browser.
Code: Select all
    CefBrowser browser_;

    browser_ = client_.createBrowser(null, useOSR, isTransparent);
    browser_.loadURL("about:blank");
    browser_.loadString("<html><body>test text</body></html>", "http://abc.com");


Thanks
kareed
Newbie
 
Posts: 6
Joined: Fri Mar 03, 2017 2:14 am

Re: How do I load html?

Postby Czarek » Sat Mar 04, 2017 2:31 am

Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: How do I load html?

Postby kareed » Sat Mar 04, 2017 3:34 pm

I tried multiple things with "data:text/html" and the browser still is blank. Any other ideas?

Thanks
kareed
Newbie
 
Posts: 6
Joined: Fri Mar 03, 2017 2:14 am

Re: How do I load html?

Postby Czarek » Sun Mar 05, 2017 1:52 am

createBrowser("data:text/html,test", ...)

Don't use loadString. Either pass to createbrowser or loadurl.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: How do I load html?

Postby kareed » Sun Mar 05, 2017 2:08 am

Unfortunately I need to load html that is generated by my software not from a url. Do I need to create a new browser each time?

Thanks
kareed
Newbie
 
Posts: 6
Joined: Fri Mar 03, 2017 2:14 am

Re: How do I load html?

Postby kareed » Sun Mar 05, 2017 2:28 am

My apologies, I didn't try the loadurl. This method worked great with loadurl.

Thanks for the help.
kareed
Newbie
 
Posts: 6
Joined: Fri Mar 03, 2017 2:14 am

Re: How do I load html?

Postby guich » Sat Aug 10, 2019 2:42 am

Czarek wrote:createBrowser("data:text/html,test", ...)

Don't use loadString. Either pass to createbrowser or loadurl.


Hi

Works fine when passing to createBrowser but not with loadurl.

Where can i find the supported types for "data:" parameter? I didn't find in the sources.

thanks
guich
Techie
 
Posts: 19
Joined: Tue Jul 30, 2019 10:11 am

Re: How do I load html?

Postby Czarek » Sat Aug 10, 2019 8:12 am

Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 12 guests