Page 1 of 1

LoadURL with URI encoded HTML content

PostPosted: Thu Apr 08, 2021 3:53 am
by G0apher
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.

Re: LoadURL with URI encoded HTML content

PostPosted: Thu Apr 08, 2021 8:53 am
by magreenblatt
Load an arbitrary URL and use GetResourceHandler() to return the contents of your string.

Re: LoadURL with URI encoded HTML content

PostPosted: Thu Apr 08, 2021 11:59 am
by G0apher
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)?

Re: LoadURL with URI encoded HTML content

PostPosted: Thu Apr 08, 2021 3:23 pm
by magreenblatt
Use an arbitrary URL with the HTTP scheme. See https://bitbucket.org/chromiumembedded/ ... t-handling