0

I am migrating a functionality for importing Icons into powerpoint from an Internet Explorer based solution to a more modern solution, as the Internet Explorer is no longer available. For this I am currently implementing a WebView2 based approach.

For this I have an Icon2.html (and the code coming with it), which when opened as a File like this, will not allow me to change the color of the Icon in the preview, here the preview icon should be orange. The Html Page uses a modified version the spectrum Color Picker for picking colors.

As the functionality was originally conceived for the Internet Explorer, the functionality works fine when launched in the Microsoft Edge using Internet Explorer Mode. A peculiar thing is however, that when I use the VSCode Live Server Extension to launch the Icons2.html as a Live Server, the color changes perfectly fine on a modern Browser. I did test the Html with the Edge-, Firefox- and the Chrome Browser (as well as asking a colleague, the problem isn't local),so it does seem like the Live Server does something to help.

As I do not have much experience using Html, Javascript and CSS, hints on where to start looking would be greatly appreciated.

1 Answers1

0

Not all code for the web is programmed (and tested) to also work with URIs using the file: protocol syntax.

Your sample screenshots show that your problems arise when using a direct local file access:

C:\Users\....
# converts to
file:///C:/Users/....

The "Live Server" (as any other server) will enable you to use the http: protocol syntax, that natively is expected by web code.

The problem (I would not to call it a fault) is part of the programming of the "spectrum Color Picker", perhaps only of your customized version.

I would expect that some depending files are not found.

  • Check the logs of your web browser's developer tools.
  • Relative paths should be used.
  • URI-analysis might be to lax. I.e. the : can be irritating in this context.
  • Surely much more ....

Perhaps you should remember:
The intention of web code is not live locally on a file system but on a web server. That such code might work in other context like using file:-URIs should be resembled as a welcome extra.

dodrg
  • 1,142
  • 2
  • 18
  • Thank you for the tips! I found the limiting factor and it is the .getSVGDocument() method, which is disabled in newer Browsers using the `file:` format, as it grants access to the users Filesystem. – Dominik Rolfes Aug 02 '23 at 07:52