Igor Markiv
Igor Markiv

Reputation: 329

How to enable developer tools in MAUI

Half years ago I started work on the project using MAUI, when I started the project I was able to open context menu on WebView by right mouse click and open Web developer tools.

For some reason from a while I lost this ability. Now, how I can enable context menu and opening of web developer tools?

Upvotes: 1

Views: 2142

Answers (2)

Isidoros Moulas
Isidoros Moulas

Reputation: 697

Microsoft Edge DevTools could be used for debugging MAUI Android Webview, please refer to the following documentation and steps:

Remotely debug Android WebViews.

Step 1. Add the following code to the MainActivity class to enable debugging of Android WebView.

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
    {
        Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
    }
}

Step 2: Build your application.

Step 3: Open the edge://inspect using the Edge browser and click the Inspect button below your Android device that appears on the page.

source: Microsoft Learn

For debugging WebView on IOS:

Connect the iOS device to the machine.

Enable the Web-Inspector option. To do so: Go to Settings > Safari > Scroll down to the bottom > Open Advanced Menu>Turn on Web Inspector

Open the desired web page to debug or preview on your mobile Safari browser. Once done, enable the Develop menu on the Mac device.

To enable the Develop menu, follow the steps below: Launch Safari browser Click on Safari at the top > Settings > Advanced Mark the checkbox – Show Develop menu in the menu bar to enable it

source: BrowserStack

Upvotes: 1

Igor Markiv
Igor Markiv

Reputation: 329

Here is an answer if you use Google Chrome. https://developer.chrome.com/docs/devtools/remote-debugging/webviews/

Upvotes: 0

Related Questions