-
Notifications
You must be signed in to change notification settings - Fork 676
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
Proposal: A WebView based on Microsoft Edge (Chromium) in WinUI 3 #1658
Comments
Perhaps you should more carefully read the issue...
Unless you are just sharing information. |
Please add printing, and print-to-PDF APIs. This is super useful when generating reports based on HTML. The current print options in UWP are terrible. https://stackoverflow.com/questions/39012591/uwp-print-webview |
Back in 2016 when I was developing full featured UWP browser for Windows Mobile I wrote this blog post about missing features in the original WebView. Some of the ideas are a bit dated, most of them are still relevant: My favourite points: Proper Popup Window handling |
I know important features that came late (or didn't come to the original WebView) are:
Am a bit concerned about the fact that if the WebView is a major component of an app and the user doesn't have the new Edge installed, that the app wouldn't work without more user involvement. Can there be a base install version of the Edge components that can be installed as a dependency? But just doesn't show the icon on the user's start menu in this scenario as in normal install. i.e. still be the evergreen model and not BYOV, but at least do the base install when it's needed by an app using the new WebView at package/install time (if needed), and not involve extra manual user steps. If the user later installs new Edge, this 'base' package all gets replaced by the main bits and WebView is none the wiser. Also, assuming as part of WinUI 3 it will work regardless of app model? And having it also be able to work when deploying via UnoPlatform would be great too. 😋 FYI @jeromelaban Can you clarify the AddWebAllowedObject, assuming you mean that a WinRT API can just be dangled off some class the developer creates and call that? But the custom object from the developer (outside of any WinRT APIs) is important too. That's also the WebView -> App bridge, but there's no mention of the App -> WebView bridge about being able to call JavaScript on the WebView instance. |
Please also refer to #1298 (proposal for access to cookies in WebView) |
Ability to view PDFs and SharePoint docs (Word, Excel, etc.) by navigating to URL. Printing APIs would be nice, too. |
@martinsuchan thank you for posting this blog. I'll take some time to go through this. @michael-hawker given Edge Chromium's planned distribution model the main case I am referencing in this failure mode would be a machine that has not been updated or in an organization that has not yet pushed the update. Yes, it would work regardless of app model. The Uno angle is a good question. Thanks for adding Jerome. In terms of WinRT access we are hoping to explore the needed API set with customers and create a plan to support the necessary usage models moving forward. |
So a question need to be asked. Would this work on Xbox? And what about IoT? I currently have an app for Xbox and Windows that uses the normal WebView when clicking on links there, but the perf is not that great, and I would switch instantly. But not having on Xbox would make things complicated. And what about IoT too? A lot of enterprise apps there are also web based, and currently stuck on EdgeHTML. In my opinion, would be quite smart to put new edge engine, read, Blink, as a dependency on Store (just like .NET Native, WinUI, etc is there). It shouldn't rely on a Edge install that the user may not have, or might be removed by the user! |
@vitorgrs Great question! The new Chromium based WebView2 should be available on Xbox and IoT as well. Ideally the Chromium WebView should be a separate package downloadable in Store, just like it works on Android, where all apps share the same Chrome WebView, that can be updated separately in Google Play. |
Working on all OS versions where WinUI 3 is supported is certainly a goal, as called out in the scoping section. We will be able to get more specific moving forward about supported endpoints for the v1, but we really love getting this feedback. The user removing the Edge browser will not be an issue as the APIs necessary for the WebView will be available as part of an OS update. |
This isn’t something to be proud of at all. </offtopic> |
I know, but that's the reality. You might be surprised at how many Microsoft's own projects use Chromium in some form. To check it out, go to https://thirdpartysource.microsoft.com and type in |
Based on APIs we wish we had in our WPF usage of WebBrowser, I hope that we have client APIs for the following: • API to manage cookies. I recall lots of pain and hoops to clear cookies for a given site/domain. |
I'm glad to hear there's a plan to get the new browser engine into apps. The existing UWP WebView control was a pain to use for us in a couple of ways, and I would love to see them considered in the design of the newer control:
|
As mentioned during the community call, I have posted an update to the proposal with a link to the draft spec for the WebView2 API. Please take a look and let us know your feedback. If you see a missing API check the IWebView2WebView interface as it might be covered in the proposed core WebView2 object. |
@adambarlow, is posting in this thread the best place for feedback on the spec? I think it's great the string returned will be a JSON object, but is there a reason it's re-string-ified vs just coming back as a System.Text.Json object? Calling out a more complete example for the JavaScript side of the WebMessageReceived in that section would be clearer as well (from a documentation perspective). Also, looks like the WebView1 WebResourceRequested event is missing. This is important for caching and filtering scenarios. The IWebView2WebView interface has a weird comment about it being deprecated and to use the 'new' one, but then there's no new one called out or documented... FYI @pagoe-msft |
Also @adambarlow @pagoe-msft, please see feedback on original WebView provided by community as found here: https://www.suchan.cz/2016/04/make-webview-great-again/ Think main points I don't see improvements on around the API surface are around access to navigation stack and cookie management. |
@adambarlow However, some of those methods in the web allowed object return an [AllowForWeb]
public sealed class Foo
{
public IAsyncOperation<IBuffer> bar(string arg)
}
webView.AddWebAllowedObject("myFoo", new Foo()); // The object returned is 'thenable'
let bufferPromise = await new Promise(resolve =>
myFoo.bar("stuff").then(resolve),
) I may be missing something but it's not clear to me how that can be achieved with the new API. |
@phraemer, we want to enable AddWebAllowedObject, this is mentioned in the 'scope' section of the proposal above as a 'should'. This won't be in the first alpha, but this is something we want to have for release. This would likely be on the corewebview WinRT object, not on the XAML element itself. |
Do you have any plans on providing an API to intercept web notifications? Also wondering if there will be an option to isolate storage/cookies per instance instead of per application scope. |
@felixse the API for that is planed for the core webview object. The cookie isolation is something we would like to have but are planning to focus on in the next version. |
Is there any dates, or estimated dates regarding the release of a WebView based on EDGE Chromium to be used from within UWP (Xamarin.Forms)? |
🦙 @hanneslarsson Adam showed a preview during the last community call starting here and mentioned that hopefully an early preview of it would be released in February. |
@michael-hawker Awesome!! Super thanks for the update! I’m so looking forward to the new webview! |
We have now released a preview of the control in WinUI 3.0 Alpha (February 2020) 🚀👩💻🎉 |
Does this also allow editing the HTML content with JavaScript disabled? I'd like to build an e-mail viewer and editor that has JavaScript disabled for security, but also allows editing a reply with the original message quoted inline in the editor. Various input events need to be handled by the application here to update the formatting accordingly. As well as an API to manipulate the DOM with the use of toolbars and other UI commands (set font, insert images, tables and such). Also, loading of remote resources like images needs to be restricted for privacy, unless it's allowed by an option. Is this supported, too? |
@ygoe have a look at I myself currently still use the legacy WebOC for its simple text editing features. |
@ygoe The HTML content is run out-of-proc from the XAML app, and it is not possible to access the DOM from the app. JavaScript would need to be enabled, at least for the script you want to run. For your second question, I believe that will be possible via the WebResourceRequested event. |
@adambarlow, is there progress in the availability of WebView2 and WinUI in general for the Xbox platform? Can we expect a Prerelease this year that will include this? |
same question for Windows IoT Core |
@adambarlow |
@johnnylq From the Windows UI Library Roadmap:
You can find the most recent release here. |
This control has been supported since the Windows App SDK 0.5 release earlier this year. With that, this Issue stands closed. |
Proposal: A WebView based on Microsoft Edge (Chromium) in WinUI 3
Summary
The Microsoft Edge browser is moving to be based on the Chromium web engine. This proposal is to create a WebView in WinUI 3 which takes advantage of the Microsoft Edge Webview2. This will allow WinUI 3 apps to host web content in the most relevant and standards compliant way.
We have now released a preview of the control in WinUI 3.0 Alpha (February 2020) 🚀👩💻🎉
Rationale
Scope
(not in v1)
(not in v1)
Proposed API
The WinUI WebView element will be built on top of the Microsoft Edge WebView2 API. We have yet to determine the full shape and set of APIs for the WebView element. A draft spec for the WebView2 has been posted to the spec repository.
APIs included in the API spec are those being proposed for the WinUI WebView element directly. Additional APIs will reside on the WebView2 core object. There are not represented in the API spec linked above.
In short; If you don't see an API in the WebView2 API spec and it is existing functionality of the current WebView, it is likely planned to be included on the base WinRT object, whose API is likely to closely match the current IWebView2WebView interface.
The high-level API structure is pictured below.
The text was updated successfully, but these errors were encountered: