D3FAU4T / D3FAU4TBOT-Hub

An all-in-one management application for D3FAU4TBOT
0 stars 0 forks source link

script.js works fine in browser, but not in the C# app #1

Closed D3FAU4T closed 1 year ago

D3FAU4T commented 1 year ago

Script.js error in C# Panel rendering

The following error occurs when trying to render the HTML file in a panel of C# Windows Form Application, however when the html file is run on browser, the script.js file works perfectly without any error. (Image below)

Resources:

  1. Editor.cs - https://github.com/D3FAU4T/D3FAU4TBOT-Hub/blob/8ac5a30231b8f811e080005ce4d98b425731df1a/Forms/Editor.cs#L16
  2. Editor.html - https://github.com/D3FAU4T/D3FAU4TBOT-Hub/blob/8ac5a30231b8f811e080005ce4d98b425731df1a/Assets/Editor.html#L770 image
D3FAU4T commented 1 year ago

Issue Identified

Finally found the problem why it works in browser and not in the C# WinForms. The main problem was that the WebBrowser of C# WinForms by default uses Internet Explorer as the Engine which Microsoft deprecated decades ago and that is why the contents are not loading properly. Who uses that in the current year 💀

Solution

Using a third party open source browser should fix the issue. Currently trying with CefSharp nuget package. It is a Chromium-based Web Browser. Hopefully it should fix the issue.

D3FAU4T commented 1 year ago

Issue fixed

Implementing CefSharp Chromium-based browser fixed the issue. HTML, CSS and JS files are now loading properly.

Cheers 🎉