Jump to content
softtouch

Detect if WebView2 Runtime is installed

Recommended Posts

Is there any way to detect that the webview2 runtime is installed on the target system?

Share this post


Link to post

I did asked myself today the same question and did made a different approach and would like to know what you think about it?

On the form with the TWebBrowser that has its SelectedEngine property set to "EdgeIfAvailable" I put in FormShow event:

WebBrowser.Navigate('about:blank');

For the WebBrowser I did created an Event for "OnNavigateBefore2" with the following content:

  if string(URL) = string('about:blank') then
    if WebBrowser.ActiveEngine <> Edge then
      begin
        // here I let my form display a message that Edge Runtime is missing and a button to open the official download site
      end;

For me it worked and now I searched for other solutions and found this thread.

(I was aware of the Registry Key but that does not ensure if user might has deleted the WebView2Loader.dll...)

Share this post


Link to post

From my experience, this is sufficient:

	TWebBrowserHelper = class helper for TWebBrowser
		function getIsUsingEdge(): Boolean;
	end;
    
function TWebBrowserHelper.getIsUsingEdge(): Boolean;
begin
	Result := Assigned(GetEdgeInterface());
end;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×