Stedak2

Is the res: protocol a dead protocol

I was trying to write a C# winForm application using the Webbrowser control. I created a resource DLL that works fine but I noticed that certain actions such as linking in a style sheet do not work. Other things such as script or html files do work.

What is the correct way to use the Webbrowser control using the res: protocol or is there a new-improved method

this line does not work:

<link href="res:/My.dll/My_css" type="text/css" />

Thanks!



Re: Internet Explorer Extension Development Webbrowser and res: protocol

IECUSTOMIZER

HI Sedak,

You should bundle all of your resources in your resource only dll.

eg.

HTML resources

MyWebPage.htm

MyStylesheet.css

MyScript.js

Logo.gif

when refering to your inline resources in your html page, you omit the res:// protocol.

eg. <link href="MyStylesheet.css" type="text/css"/>

BTW your res protocol call should be res://My.dll\My_css"

Use of the res protocol has been restricted in IE7 and IE6 SP2. You cannot call a resource from within a normal online or offline page.

Regards.






Re: Internet Explorer Extension Development Webbrowser and res: protocol

Stedak2

It works perfectly!

If I wanted to use XML/XSL transformations and include the same type of resources how would I accomplish that I do my transformations with XslCompiledTransform which mean I would be setting the

webBrowser1.DocumentText = transformedXml;

The resources would be embeded scripts, css, etc. in my resource dll. Is there a way to do that

Thanks!





Re: Internet Explorer Extension Development Webbrowser and res: protocol

IECUSTOMIZER

Hi,

There are limitations to the type of resources you can add to a dll/exe using Visual Studio (that I have found anyway, I may be wrong)

I use a tool http://www.angusj.com/resourcehacker/

to add addional resources once I have compiled an empty (except for a version manifest) dll/exe.

I don't know the equivalent in C#, but in your case to load a resource into the document text you could use the api LoadResource (C# should have a System equivalent)

so

webBrowser1.DocumentText = LoadResource("transformedXml",23)

23 is the constant for html resource, but you could use whatever you want.

Sounds like you are creating a toolbar or bho. Once you have downloaded reshacker, have a look how other toolbars/bhos are constructed. (Hint - The Live toolbar uses satellite resource only dll's to hold locale dependant resources.)

Regards.

Don't forget to mark my response as your answer, so I can claim another tick.