开发者

Embed HTML + javascript files in Visual Studio Winforms Project

开发者 https://www.devze.com 2023-03-02 04:31 出处:网络
I\'m having a hard time trying to integrate some things I thought they would be easy to integrate, but I was wrong.

I'm having a hard time trying to integrate some things I thought they would be easy to integrate, but I was wrong.

I have an html file and some javascript files (with no server logic in the html code) and i need to embed them in a开发者_JS百科 Visual Studio winform Project in order to use a WebBrowser control an invoke this html file (which includes the .js files) and I need to have the files inside the client application when I call them.

How can I achieve this?

Thanks in advance!


If everything is in one file, you can embed the file in a ResX container and write

webBrowser.DocumentText = Resources.HtmlSource;

If you have multiple files (eg, images and external .js files), you'll need to copy them to physical files on the end-user's machine to make relative paths work. (or you could put them all into a .mhtml file)

0

精彩评论

暂无评论...
验证码 换一张
取 消