Re: CDHtmlDialog fail to load image in Vista



Hi David,

Thank you so much for spending some time experimenting on it and provided me
such a comprehensive explanation. Yup, I chose to load all externally and it
now works. Also, a special thanks for even telling me to navigate in absolute
path, rather than relative path as I would certainly make this mistake.

John

"David Ching" wrote:

"John Tan" <JohnTan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4D4A62B3-A2DB-43A6-B526-866CC5AF8AD3@xxxxxxxxxxxxxxxx
Hi David,

Thanks for suggestion. I have tried all ways which I could think of,
including the ones you suggested:
<IMG src="file://banner.gif">
<IMG src="banner.gif">
<IMG src="file:///./banner.gif">
<IMG src="file:.\banner.gif">
<IMG src="file:<absolute path>banner.gif"
None of the above worked.

Under XP, below works:
<IMG src="file:banner.gif">
<IMG src="file:.\banner.gif">
and the rest which I tried above don't.


Hi John, I verified that on Vista, <IMG src="banner.gif"> does not work.
But this is assuming that this tag is in the default HTML page that is being
displayed in the DHTMLDialog as the one compiled into the .exe as a
resource. If I take the same HTML file and display it with:

BOOL CDHtmlImageDlg::OnInitDialog()
{
CDHtmlDialog::OnInitDialog();
...

// display HTML file by specifying full file path, and don't use the
default one
Navigate (_T("e:\\src\\dcsd\\dhtmlimage\\debug\\DHtmlImage.htm"));

return TRUE; // return TRUE unless you set the focus to a control
}

then the banner.gif is shown properly.

So I think what is happening is that the HTML page you are trying to display
is coming from the resource, and it is referencing an external .gif file,
but with IE7 protected mode on Vista, this crosses "domains" and is
disallowed for security reasons. You can verify it by keeping the HTML file
as a resource, but changing the tag to be something like:

<IMG alt="" src="res:\#2/#1">

where the image to display is the first one in the .rc file. See
http://www.codeproject.com/dotnet/dhtmldialog.asp?df=100&forumid=2135&exp=0&fr=26&select=274857#xx274857xx
for a little comment on how the image specification works. I'm not sure how
exactly the res: protocol works.

That way both the HTML file and the image are in the same domain (i.e. the
resources). Or else do what I did and load the HTML file and the image
externally as files, so they are still in the same domain.

Cheers,
David






.



Relevant Pages

  • Re: CDHtmlDialog fail to load image in Vista
    ... Thanks for suggestion. ... If I take the same HTML file and display it with: ... is coming from the resource, and it is referencing an external .gif file, ...
    (microsoft.public.vc.mfc)
  • html display src image in IE locally vs IIS
    ... the html file and the referenced image are in the same ... DOES display in IE, and other times, it does not! ... Then I remember and load the ... Loading the page locally ALWAYs displays the referenced image ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: loading html pages in frames
    ... >>> On the server when we click on the link we get a momentary ... the html file loads correctly in the same window. ... >>> to load it but I get the same behaviour as trying to load from the ... >>> temp->data virtual folder. ...
    (microsoft.public.inetserver.iis)
  • Re: Open txt or csv file and read in Java
    ... What I do with javascript is to have an object tag on the page I want ... to load .txt data onto, ... This loads a second html file onto the page. ... into the parent html file, where 'x' is some variable you have ...
    (comp.lang.javascript)
  • Re: Turn off caching - Please help!
    ... In my case I have a iFrame that I load ... > with several versions of an html file. ... Still, most browsers behave this ...
    (microsoft.public.dotnet.framework.aspnet)