Accessing Dev Tools in Webview / CUSTOMGUI_HTMLVIEWER
-
Working on a Python plugin with a web frontend, and running into an issue with the accessing developer tools.
On Windows, when the URL is blank, you can easily right click and select "Inspect" to pull up dev tools, but if you have a URL loaded, the "Inspect" option is no longer available.
Is anyone aware of a workaround for this?
Blank URL with Inspect Option
Loaded URL without Inspect Option
Also, I can't seem to access dev tools (aka Right Click > Inspect) on MacOS in either scenario.
-
Hey @justintaylor-dev,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
This feature, the dev tools, is intentionally disabled and we therefore cannot share how to circumvent this restriction. When you want to debug your web content, we recommend using an external browser to do this.
Thank you for your understanding,
Ferdinand -
@ferdinand Thanks for your response and solid forum overview, good inspiration for my own community.
Thanks for clarifying that dev tools is intentionally disabled. I am able to get debugging working with a separate web browser since messages talk back and forth to Python over web sockets so testing in Cinema isn't required, however it would make debugging these types of plugins much easier if we could just stay in Cinema.
Is the main reason dev tools is disabled due to security concerns? Asking because I'm not seeing how enabling dev tools could potentially be exploited as it's done in many other host apps with web frontends like Adobe, Figma, Resolve, etc.
If there are security concerns, I wonder if a new option could be added in preferences to enable / disable webview debugging.
Thanks,
Justin -
Hey @justintaylor-dev,
to give here a bit clarification, when I saw your question, I simply looked at our code and:
- I saw there that it has been deliberately disabled in the WebView2 bindings for Windows.
- There exists an option to disable this behaviour for developers, but it is simply not public.
- I briefly talked with the dev and they pretty much made up their mind on that this feature cannot be shared.
- Yes, the concern were security concerns, primarily that people could use it to execute JS via the dev console.
I quite frankly cannot really grasp that decision either, as it makes little sense in an application that runs a Python VM without restrictions. I could dissect this further but this will not lead anywhere. I am afraid we will not change our stance on this. I see how this can be useful for development, but with some extra work, you should be able to debug your web content with an external browser. E.g., run a little web server within our Python VM which serves your presumably dynamic content based on Cinema 4D scene or application data.
Cheers,
Ferdinand -
@ferdinand I really appreciate you looking into this and getting a response from the team so quickly.
Agree that it seems just as secure or insecure to allow a JavaScript console as it is to allow the Python console that's already a part of Cinema 4D.
But yes, the external browser workflow can work for now, just requires a few more steps to get up and running.
Sounds like the team is pretty set on not opening this up, but in the future if there are other API requests, is this forum the best place to add these or is there somewhere else we should submit API requests?
Thanks,
Justin -
Hey,
yes, the forum is the best place, and for normal Python API feature requests the hurdles are also bit lower since SDK, i.e., us, then does own the code
Cheers,
Ferdinand -
@ferdinand Great thanks!