9

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.

2 Answers 2

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").

Sign up to request clarification or add additional context in comments.

3 Comments

I 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...
If you embed a javascript file as a resource then how do you refer to it from the embedded html?
better than the microsoft documentation
0

Try using res: protocol. For example

res://C:\path\to\exe_or_dll\project.exe/helloworld.htm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.