Is is possible to debug a (desktop)htmlviewer?

in a web project, one can activate the developper tools in almost any browser and explore the “real” code
but to inspect some html/javascript code I embed in a desktop htmlviewer, how can I proceed ?
can you enable the “inspect element” context menu in an html viewer for desktop, or display the developper tools for web there ?
is it even possible ?
thanks.

Copy it to a web browser and debug there. HTMLVewer isn’t a full web browser and doesn’t have things like a debugger.

If you’re on a Mac Safari has the same rendering engine.

1 Like

Absolutely. In a terminal:

defaults write <your-bundle-identifier> WebKitDebugDeveloperExtrasEnabled -bool YES

this works fine on macos, but is there a way to get the web inspector under linux or windows ?
thanks.

Unfortunately not that I’ve found. I thought I’d put in a Feedback Case a long time ago to expose an inspector in CEF, but I can’t find it now. In the end, I overrode the JavaScript console object and direct any data from any of its function calls back to my app and print them to System.DebugLog. That at least points me in the right direction when things are going wrong.

it would be nice… the web inspector exists under linux at least

Well, it exists in Firefox. That’s quite a different beast from the embedded HTMLViewer rendering engine. It may not be present in the package Xojo links against or may not be exposed. We just don’t know. @William_Yu might be able to shed some light on any work that may have been done to expose the inspector for DesktopHTMLViewers.

1 Like

Right, for Linux and Windows we’d have to expose this functionality for it to be used. @Jean-Yves_Pochez Please file a feature request if this is important to you, thanks.

1 Like

if you use MBS Xojo Plugins you could try our ChromiumBrowserMBS class:

  dim m as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS
  m.ShowDevTools

for CEF based htmlviewer on Windows.

Or you could try our WebView2ControlMBS control.
There you could set AreDevToolsEnabled property to true or run OpenDevToolsWindow method.

this is not as important to me as I run on macos where the web inspector feature exists
I can debug 99.9% of my htmlviewer experiments on macos
I wonder for people running on linux or windows that might need this as an important feature !