WebView2Samples icon indicating copy to clipboard operation
WebView2Samples copied to clipboard

Only one sample

Open rsemenoff opened this issue 5 years ago • 2 comments

Hi, I downloaded the repository and there is only the one sample. It is actually just a web browser application. I would like to see a sample that demonstrates display of html content that is compiled into the executable, and the handling of ajax calls programmatically within the application itself. Its not at all clear that webview2 is capable of doing any of this.

rsemenoff avatar Feb 23 '20 00:02 rsemenoff

Hi, thanks for your feedback! Good point. We should have a sample demonstrating application UI scenarios.

When you say HTML content compiled into the executable, we do have NavigateToString for loading HTML as a string. There's also the WebResourceRequested event for intercepting any web request and substituting your own response. Can you elaborate on how you would want to compile HTML content into the executable? As module resources you want to pull our as strings or binary blobs at runtime?

For handling AJAX calls programmatically, can you elaborate on what you want to do? Does handling the ajax call programmatically within the application mean the native code provides the HTTP response to AJAX calls initiated within the webview? WebResourceRequested may help with that.

We do have the WebView2Browser that has one WebView for displaying web content and another that acts as application UI. The application UI part is closer to what you're asking about generally but doesn't cover the specifics you mention.

david-risney avatar Feb 24 '20 17:02 david-risney

To elaborate on how I would compile HTML into the executable, I dont have any specific requirement, it could be a resource string or a binary blob depending on the C++ library capabilities. Its just data that was assembled using a python application. As far as ajax, it is simply my assumption the webview2 can actually process js, which is what I want, because I already have a python/flask app with a js UI that I want to package into a proper self-contained app and distribute via commercial channels such as the windows app store. I assume that MS is aligned with that approach, so the lack of clear sample code would seem to be an issue.

rsemenoff avatar Mar 01 '20 23:03 rsemenoff