LoadURL with URI encoded HTML content

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

LoadURL with URI encoded HTML content

Postby G0apher » Thu Apr 08, 2021 3:53 am

I was earlier using LoadString to load HTML string that includes <script> elements as well as references .js files using a custom scheme. When loading the HTML using LoadString (in older CEF version), the CefClientHandler::GetResourceHandler() gets called so I can handle the request and return a custom resource handler. But now when I convert the HTML content into a data:text/html;base64,<base-64 encoded data> and call LoadURL, then I no longer get the callbacks for any of the resource handler methods.

Is this a fallout of the change from LoadString to LoadURL? Any recommendations on how to handle this? The HTML content has got both inline script elements and also references javascript from a referenced JS file.
G0apher
Techie
 
Posts: 13
Joined: Sat Sep 22, 2018 12:16 am

Re: LoadURL with URI encoded HTML content

Postby magreenblatt » Thu Apr 08, 2021 8:53 am

Load an arbitrary URL and use GetResourceHandler() to return the contents of your string.
magreenblatt
Site Admin
 
Posts: 10832
Joined: Fri May 29, 2009 6:57 pm

Re: LoadURL with URI encoded HTML content

Postby G0apher » Thu Apr 08, 2021 11:59 am

Thanks for the response.

I am already using such an URL but instead of a resource handler to deliver the HTML content, I call the LoadString (and now LoadURL with URI Data) during OnBeforeBrowse. Do you mean I should be trying with an arbitrary URL with a custom scheme to load the HTML content (in addition to the custom scheme for the js file)?
G0apher
Techie
 
Posts: 13
Joined: Sat Sep 22, 2018 12:16 am

Re: LoadURL with URI encoded HTML content

Postby magreenblatt » Thu Apr 08, 2021 3:23 pm

Use an arbitrary URL with the HTTP scheme. See https://bitbucket.org/chromiumembedded/ ... t-handling
magreenblatt
Site Admin
 
Posts: 10832
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Phylanx and 24 guests