PRB: Cannot Insert a Style Sheet Using a Res: Protocol URL (325482)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 5.5 SP1
  • Microsoft Internet Explorer (Programming) 5.5 SP2

This article was previously published under Q325482

SYMPTOMS

An ActiveX control or other code that manipulates a DHTML document can change the appearance of the document by using the IHTMLDocument2::createStyleSheet() method to add a style sheet to the document.

Before the installation of the May 15, 2002, Cumulative Patch for Internet Explorer, the style sheet can be drawn from a resource in the executable file. For example:
hr = pDoc->createStyleSheet("res://c:\\mypath\\myctl.dll/101", -1, &pStyleSheet);
				
After installing the May 15, 2002, Cumulative Patch for Internet Explorer, if the HTML document does not come from either the local computer or from a trusted site, you receive the following error message:
0x8007000E Out of memory
For more information about the May 15, 2002, cumulative patch, see the "References" section.

CAUSE

This behavior is by design.

RESOLUTION

To dynamically add a style sheet to a page, use one of the following options: NOTE: The sites to which you are adding the style sheet have to be added to the Trusted sites zone.

MORE INFORMATION

To protect data on the local computer, after you install the cumulative patch mentioned in this article, Internet Explorer allows creation of a style sheet by using a file from the local computer only if the HTML page to which the style sheet is being added comes from either the local computer or from a Web site that is in the Trusted sites zone.

A resource from an executable file is considered to be from the local computer. This is true even if the executable is an ActiveX Control, an add-in to Internet Explorer, or a program that is hosting the WebBrowser Control.

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

321232 MS02-023: May 15, 2002, Cumulative Patch for Internet Explorer

For more information about scripting the styleSheet Object, visit the following MSDN Library Web site:

Modification Type:MajorLast Reviewed:5/10/2003
Keywords:kbprb KB325482