Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 3.32 KB

File metadata and controls

66 lines (44 loc) · 3.32 KB
title Debug WebView2 apps with Microsoft Edge DevTools
description How to open Microsoft Edge DevTools when using a WebView2 app.
author MSEdgeTeam
ms.author msedgedevrel
ms.topic article
ms.service microsoft-edge
ms.subservice webview
ms.date 02/21/2025

Debug WebView2 apps with Microsoft Edge DevTools

Use Microsoft Edge Developer Tools to debug web content displayed in WebView2 controls, in the same way that you can debug another webpage that's displayed in Microsoft Edge.

DevTools debugging in a WebView2 control

When you're using a WebView2 app, there are several ways to open DevTools:

  • Press F12.
  • Press Ctrl+Shift+I.
  • Right-click the page and then select Inspect.

An app can also use the OpenDevToolsWindow API to programmatically open a DevTools window. For example, you can use this approach if the above hotkeys and the context menu items have been removed.


If none of the above approaches are available, you can add --auto-open-devtools-for-tabs to the browser arguments via an environment variable or registry key. This approach will open a DevTools window when a WebView2 is created.

Source maps with the WebResourceRequested event or virtual host name mapping

Source maps are needed to debug the source code of compiled content, including:

  • Transpiled JavaScript, such as TypeScript or minified JavaScript.
  • Compiled CSS, such as SASS or SCSS.

WebView2 doesn't load source maps that are referenced by content which was loaded by using either approach:

See also