It is currently Wed Dec 02, 2020 4:21 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Webview2 control - Chromium browser for Purebasic (Windows)
PostPosted: Sun Aug 30, 2020 11:49 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 696
Update 1 November 2020
  • Updtated to 1.0.674-prerelease, now you can use the stable or prerelease SDK versions to test the experimental apis.

Webview2 Chromium browser control coded in PB, project is here:
https://github.com/omegakode/PBWebview2

Note: This is not a wrapper, is a port of the C/C++ API, so you have full access to the control.

To test it you need to run the WebView2 Runtime Installer(disable ad blockers):
https://developer.microsoft.com/en-us/microsoft-edge/webview2/

To test prereleases you need to install edge dev or canary:
https://www.microsoftedgeinsider.com/en-us/download

Now you can use either the stable SDK version or the prerelease version to try the experimental apis.

If you are only interested in the stable release install only the WebView2 runtime, the prerelease will not work.

If you are interested in both the stable and prerelease versions uninstall the WebView2 runtime and install edge dev only.

To use the stable release in code simply include the PBWebview2.pb file located in the project root folder, to use the prerelease version include the PBWebview2.pb file located in the prerelease folder.

The examples use the stable version include, but they also work with the prerelease one.

Then clone or download the project and simply run the examples with DPI aware enabled.
They are configured for 64bit, to test 32bit copy WebView2Loader.dll from the x86 folder to the examples folder.

You can interact from javascript easily through a purebasic object in 'PB_Host_Object.pb', see examples. You can load the content from the executable as a resource or from disk.

There are a lot of files in the project but the only one you need to include in your project is 'PBWebView2.pb'.
It may seem a little complicated at first because the creation is asynchronous but is simple, see 'basic_browser_async.pb' for the most basic example.

It uses the excellent VCall module from Wilbert.

License is MIT.

If you find it useful there is a donate button in the github readme.

Webview2 Reference:
https://docs.microsoft.com/en-us/microsoft-edge/webview2/

Webview2 SDK, change extension to .zip
https://www.nuget.org/packages/Microsoft.Web.WebView2

Bootstrap example
Image
Ohm Browser
Image


Last edited by Justin on Sun Nov 01, 2020 11:39 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Sun Aug 30, 2020 11:42 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 134
Location: Spain
Justin wrote:
To test it first you need to install MS Edge Dev Channel:
https://www.microsoftedgeinsider.com/en-us/download


So... the compiled PB program only work on a computer where Edge is installed?


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Aug 31, 2020 12:15 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1153
Location: Amphibios 9
Caronte3D wrote:
So... the compiled PB program only work on a computer where Edge is installed?

Yes, that is correct. Alternatively you can run the WebView2 Runtime installer (make sure that your ad blocker is turned off on this page).

But you can assume that Edge Chromium will be the default browser in future Windows installations.

Greetings ... Peter

_________________
Hygge


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Aug 31, 2020 9:25 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 22, 2016 5:33 pm
Posts: 134
Location: Spain
I just tested the examples and everything works well, I'm thinking about the huge possibilities.
Thanks you so much! :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Aug 31, 2020 10:05 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jul 03, 2003 6:53 pm
Posts: 1325
Location: England
Brilliant, thank you :!: :D
You've even exposed PB functions to JS 8)

Hopefully this will give Fred a flying start in making PB's official WebGadget much more modern in a (not too) future release.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Aug 31, 2020 12:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 171
Location: France
It's very interesting. I especially like the more modern look of the bootstrap example.
I would like to reproduce this kind of interface but i don't know how, it seems outside of my skills!
Thank you for sharing it in an open way, with the permissive MIT license

I noted the 5 processes msedgewebview2.exe
Do you know what they are used for and if there is a way to reduce memory usage (~42Mb for bootstrap) ?
Same question for the user data folder %LocalAppData%\Temp\AppName.exe.WebView2 (~19Mb)
At the same time, it's no bigger than that, these days.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Aug 31, 2020 10:47 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 696
Hi ChrisR, about the bootstrap example i just copied a form example from the bootstrap page :D
https://getbootstrap.com/docs/4.5/components/forms/

The msedgewebview2.exe process are normal, some things are in external process it's more secure this way, although i don't know exactly what they are.

About memory usage you can pass Chromium flags when creating the control
https://peter.sh/experiments/chromium-command-line-switches/,
maybe disabling some things will help, i did it in the bootstrap.pb to disable web security, see main() proc.

About the user data folder, yes it's a hassle, but it seems tied to the control, there is a chapter on that in the documentation
https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/userdatafolder
I guess a good option it's to set it to the user temp folder and delete it when the app exits, i did a function for that wv2_DeleteUserDataFolder() in Webview2_Helper.pb because it's a bit tricky it's used in the bootstrap.pb, window_Close() (commented).


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Tue Sep 01, 2020 5:34 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 696
Just noticed that microsoft has introduced improvements in ram usage for Edge in the last Windows 10 2004 update:
https://www.zdnet.com/article/windows-10-chrome-and-edge-slash-ram-use-thanks-to-this-microsoft-backend-change/
I have not installed yet, will try it later to see if there is any difference.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Tue Sep 01, 2020 10:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 696
After the 2004 update i noticed a little improvement in ram usage, 38mb for the bootstrap app compiled exe, not sure if its significant enough.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Thu Sep 03, 2020 11:41 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 171
Location: France
Justin wrote:
Just noticed that microsoft has introduced improvements in ram usage for Edge in the last Windows 10 2004 update


I tested by myself to check the improvements in ram usage between Google Chrome v85.0.4183.83 and MS Edge 85.0.564.44
I confirm the gain, ~27% in my case with 5 open tabs
Chrome = 968 Mb, Edge = 706 Mb and for info Firefox v78.2.0esr = 838 Mb
I have 138 Mb of ram used with basic_browser_async and a youtube video in the single tab

If you wish to continue your examples, It would be nice to have the address bar and move forward or backward as it is done in WebView2Browser


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Fri Sep 11, 2020 12:52 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 726
Location: Spain
This is simply awesome!
I hope MS doesn't leave the project in the lurch.
With this one we could dream with an official and updated WebGadget, right?

Thanks a lot, Justin!

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Fri Sep 11, 2020 11:15 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 17, 2007 8:35 pm
Posts: 118
Location: USA
Just wanted to post here a sincere thanks for taking up this project and posting it.

I tested the examples and they all work here fine.

I have been looking for something like this for quite some time. THANK YOU!


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Sun Sep 13, 2020 11:29 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 696
Hi, thanks for the feedback. Some updates:

Updated the code to the new 0.9.622.11 Webview2 SDK

resources.pb example now uses windows resources with .rc files, you have to add the file resources.rc in compiler options. The bootstrap example still uses the includebinary method.

Created a multitab browser to test the functions, supports all major standard shortcut keys and fullscreen.
I called it Ohm, it's in the Ohm Browser folder, uses pb vectoricons.
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Sep 14, 2020 8:39 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14179
Location: France
Finally a new native solution is coming ! Thanks for the wrapper, we will look into it once it gets live.


Top
 Profile  
Reply with quote  
 Post subject: Re: Webview2 control - Chromium browser for Purebasic (Windo
PostPosted: Mon Sep 14, 2020 8:40 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1153
Location: Amphibios 9
Fred wrote:
Finally a new native solution is coming ! Thanks for the wrapper, we will look into it once it gets live.

Image

_________________
Hygge


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye