Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Add draft implementation of the WebView using EdgeHtml control #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kant2002
Copy link

  • During initialization failures aplication eixting
  • No custom scheme support
  • No loading files from file:// scheme
  • No communication with host support
  • Work only in STA (seems to be MSEdge limitation)

I would like to implement more modern c++/winrt, but that requires version C++ 17. And that seems to be another request.

@SteveSandersonMS
Copy link
Owner

This looks really interesting. Thanks for getting started on it!

I would like to implement more modern c++/winrt, but that requires version C++ 17

Please feel free to switch the project to C++17 in your PR if that helps with implementing this cleanly and doesn't have any other major drawbacks.

@kant2002
Copy link
Author

@SteveSandersonMS Thank for feedback. I will play with C++ 17. On closer investigation support for Edge seems to be impossible to implement fully. Would like to hear you opinion on what's very essential to support in the list of issues which I have.

Another issue which should be worked-out separately is handling errors. right now MessageBox is popping up if you do not have WebView (Chromium) installed. I would like to have exception to be produced by library and not message boxes. If you have something in your mind how to make that work except changing export declaration (returning int instead of void), let me know. This should be whole new issue, but I just want to capture your attention while you are here.

@yuri-vin
Copy link

Hello @kant2002 , thanks for your contribution. Did you make any progress on this lately? Is it correct that this implementation allows for running WebWindow in EdgeHTML engine (old Edge browser)? This seems like an interesting solution as a fallback scenario when the new Edge (Chromium) is not available on the user's system.

I didn't dig too deep into the details, but for me the HelloWorldApp shows an error message with 0x80004004 code right after the window is initialized.

@kant2002
Copy link
Author

@yuri-vin believe it is impossible properly implement WebWindows as it is in old Edge. Given that Steve explicitly express that any functionality added should still support whole scope of existing functionality, I cannot made it. One of the obvious roadblocks is injection of JS into EdgeHTML. I cannot find article how to do that. Without that, I doubt my work can be implemented practically.

If you know how to inject JS into running page in the EdgeHTML, please give me hint, and I can try to revive this branch

@reflectronic
Copy link

It should be possible using IWebViewControl.InvokeScriptAsync and IWebViewControl2.AddInitializeScript, no?

@kant2002
Copy link
Author

I can try again. Let me recall where I stuck.

@kant2002
Copy link
Author

@reflectronic do you now how I can implement custom scheme support?

- During initialization failures aplication eixting
- No custom scheme support
- No loading files from file:// scheme
- No communication with host support
- Work only in STA (seems to be MSEdge limitation)

I would like to implement more modern c++/winrt, but that requires version C++ 17. And that seems to be another request.
@kant2002
Copy link
Author

@yuri-vin The error which you are seeing is from fact, that you load files from local file system. EdgeHTML cannot display data from local filesystem. At least I still do not found an way to make it load file:// protocol. There possible to embed simple HTTP server as part of WebWindow, but that's defeat whole thing to be minimalistic library.

@reflectronic Other thing which is missing is the add_WebMessageReceived handler which implemented in WebView2. I can implement receiving notification same way as Android Cordova implement that, having queue in the Browser and drain it periodically. But on the whole fallback seems to be unreliable and not worth pursuing as part of that library.

@SteveSandersonMS what's your position on having limited fallback functionality to EdgeHTML where unsupported scenarios will clearly throw and documented?

@yuri-vin
Copy link

The error which you are seeing is from fact, that you load files from local file system.

Thanks for the update, I'll check if loading resources from the web rather than the local file system solves the error. In my particular case this should not be a problem since I'm already running a local web server to run the aspnet core app, but in general yes, this seems like a big limitation...

@reflectronic
Copy link

I played around a lot with WebView. The functionality seems to be a little messed up, probably since they have "deprecated" it in favor of WebView2. I couldn't get things like AddInitializeScript to work properly; I'll try and investigate the Microsoft Community Toolkit's bindings and see why that might not be working for me.

If nothing else, I did figure out how to get local web pages to render. There are still caveats; custom URIs do not really work, and I don't think it's possible to implement them properly.
image

You can test it out on my fork at https://github.com/reflectronic/WebWindow/tree/edgehtml. I used a C++/WinRT implementation, separate from this PR's impl.

@jspuij
Copy link

jspuij commented Apr 2, 2020

I have a managed old Edge fallback implementation in https://github.com/jspuij/BlazorWebView. Somebody might be interested in backporting it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants