How do I add a local script file to the HTML of a WebBrowser control?

后端 未结 4 1207
遥遥无期
遥遥无期 2020-12-06 02:34

This seems really dumb. I\'ve tried a bunch of different ways and it\'s just not working. I have a WinForms app with a WebBrowser control. If I try with a raw html file on m

4条回答
  •  有刺的猬
    2020-12-06 02:56

    This is because of security reasons. You need a webserver to do that, else you can access any file on a system which would be a big security hole.

    In developement mode, you can set e.g on chrome:

    chrome.exe --allow-file-access-from-files  
    

    And you will be able to run your code.

提交回复
热议问题