I am using a web browser control that display html page in window form now I want to embed html and javascript files and css files as resource.
Asked
Active
Viewed 9,797 times
2 Answers
3
- Add your resource files - HTML, CSS, JS files etc. to your Visual Studio project.
- Select the file and goto Properties window for that file by pressing F4.
- Set the "Build Action" property to "Embedded Resource"
- Re-compile the application
- Use the following answer to get the embedded resource - https://stackoverflow.com/a/3314213/10458
PS: If you have a default namespace set in your project's properties, then you will have to prefix that to the file-name. For example if your file-name is File1.html
and your default namespace is MyCompany.MyProject
then you will have to use GetManifestResourceStream("MyCompany.MyProject.File1.html")
.

Community
- 1
- 1

Dhwanil Shah
- 1,072
- 1
- 9
- 25
-
1I have css in my html and the web browser control seems to be ignoring it. More specifically I have css that will give my divs rounded corners... – mracoker Jul 24 '12 at 20:11
-
4If you embed a javascript file as a resource then how do you refer to it from the embedded html? – noelicus May 16 '13 at 06:05
-
better than the microsoft documentation – jkamdjou May 05 '17 at 01:47
0
Try using res: protocol. For example
res://C:\path\to\exe_or_dll\project.exe/helloworld.htm

Pavel Krymets
- 6,253
- 1
- 22
- 35