From: badzio on
Hi,

I've new problem with WebBrowser :)
I generate html document at runtime and display it in webbrowser using
code:
WebBrowser webbrowser;
String myHtmlDoc;
webbrowser = new WebBrowser();
myHtmlDoc = @"<html>message to display <img='\temp\image.png' \></
html>";
webbrowser.DocumentText = myHtmlDoc;

the result is:
I see text 'message to display' but instead of image I see 'red X' -
you know, the image which is shown when browser cannot find the image
to display.
Ofcourse path \temp\image.png is valid, this file exists.
If I create a document on the device with mentioned content and load
it to webbrowser (using Navigate()) than image is displayed.
If I use image from network:
myHtmlDoc = @"<html>message to display <img='http://server/image.png'
\></html>";
than the image is displayed.
Seems that in DocumentText cannot contain reference to image on the
device. Does anybody know how to solve that problem?
From: Paul G. Tobey [eMVP] paultobey _at_ earthlink _dot_ on
Wouldn't that need to be "file://temp/image.png" or something like that? The
problem is likely to be that the WebBrowser doesn't know what the root path
from which the HTML was loaded is, so it can't interpret \temp\image.png.
That is \ related to where? What server? There might be some way to tell
the WebBrowser object that information before you set up the document text, I
suppose...

Paul T.

"badzio" wrote:

> Hi,
>
> I've new problem with WebBrowser :)
> I generate html document at runtime and display it in webbrowser using
> code:
> WebBrowser webbrowser;
> String myHtmlDoc;
> webbrowser = new WebBrowser();
> myHtmlDoc = @"<html>message to display <img='\temp\image.png' \></
> html>";
> webbrowser.DocumentText = myHtmlDoc;
>
> the result is:
> I see text 'message to display' but instead of image I see 'red X' -
> you know, the image which is shown when browser cannot find the image
> to display.
> Ofcourse path \temp\image.png is valid, this file exists.
> If I create a document on the device with mentioned content and load
> it to webbrowser (using Navigate()) than image is displayed.
> If I use image from network:
> myHtmlDoc = @"<html>message to display <img='http://server/image.png'
> \></html>";
> than the image is displayed.
> Seems that in DocumentText cannot contain reference to image on the
> device. Does anybody know how to solve that problem?
> .
>
From: badzio on
I didn't find any method to tell WebBrowser what's the root. file://
didin't help.

On 13 Sty, 20:02, Paul G. Tobey [eMVP] <paultobey _at_ earthlink _dot_
net> wrote:
> Wouldn't that need to be "file://temp/image.png" or something like that?  The
> problem is likely to be that the WebBrowser doesn't know what the root path
> from which the HTML was loaded is, so it can't interpret \temp\image.png.  
> That is \ related to where?  What server?  There might be some way to tell
> the WebBrowser object that information before you set up the document text, I
> suppose...
>
> Paul T.
>
> "badzio" wrote:
> > Hi,
>
> > I've new problem with WebBrowser :)
> > I generate html document at runtime and display it in webbrowser using
> > code:
> > WebBrowser webbrowser;
> > String myHtmlDoc;
> > webbrowser = new WebBrowser();
> > myHtmlDoc = @"<html>message to display <img='\temp\image.png' \></
> > html>";
> > webbrowser.DocumentText = myHtmlDoc;
>
> > the result is:
> > I see text 'message to display' but instead of image I see 'red X' -
> > you know, the image which is shown when browser cannot find the image
> > to display.
> > Ofcourse path \temp\image.png is valid, this file exists.
> > If I create a document on the device with mentioned content and load
> > it to webbrowser (using Navigate()) than image is displayed.
> > If I use image from network:
> > myHtmlDoc = @"<html>message to display <img='http://server/image.png'
> > \></html>";
> > than the image is displayed.
> > Seems that in DocumentText cannot contain reference to image on the
> > device. Does anybody know how to solve that problem?
> > .

From: Paul G. Tobey [eMVP] paultobey _at_ earthlink _dot_ on
I guess that, if you've checked everything that could work for the case of
setting the document text explicitly, maybe you should look at other methods
of getting the browser object to load your generated page (generate it to
disk and point the browser to it, etc.)

Paul T.

"badzio" wrote:

> I didn't find any method to tell WebBrowser what's the root. file://
> didin't help.
>
> On 13 Sty, 20:02, Paul G. Tobey [eMVP] <paultobey _at_ earthlink _dot_
> net> wrote:
> > Wouldn't that need to be "file://temp/image.png" or something like that? The
> > problem is likely to be that the WebBrowser doesn't know what the root path
> > from which the HTML was loaded is, so it can't interpret \temp\image.png.
> > That is \ related to where? What server? There might be some way to tell
> > the WebBrowser object that information before you set up the document text, I
> > suppose...
> >
> > Paul T.
> >
> > "badzio" wrote:
> > > Hi,
> >
> > > I've new problem with WebBrowser :)
> > > I generate html document at runtime and display it in webbrowser using
> > > code:
> > > WebBrowser webbrowser;
> > > String myHtmlDoc;
> > > webbrowser = new WebBrowser();
> > > myHtmlDoc = @"<html>message to display <img='\temp\image.png' \></
> > > html>";
> > > webbrowser.DocumentText = myHtmlDoc;
> >
> > > the result is:
> > > I see text 'message to display' but instead of image I see 'red X' -
> > > you know, the image which is shown when browser cannot find the image
> > > to display.
> > > Ofcourse path \temp\image.png is valid, this file exists.
> > > If I create a document on the device with mentioned content and load
> > > it to webbrowser (using Navigate()) than image is displayed.
> > > If I use image from network:
> > > myHtmlDoc = @"<html>message to display <img='http://server/image.png'
> > > \></html>";
> > > than the image is displayed.
> > > Seems that in DocumentText cannot contain reference to image on the
> > > device. Does anybody know how to solve that problem?
> > > .
>
> .
>
From: badzio on
Yeah, I've solved that problem by writing html on the device and load
it from local storage. Hope that client'll accept creating temporary
file :)
But if anybody solve that problem another way, I'd be greatful


On 14 Sty, 22:33, Paul G. Tobey [eMVP] <paultobey _at_ earthlink _dot_
net> wrote:
> I guess that, if you've checked everything that could work for the case of
> setting the document text explicitly, maybe you should look at other methods
> of getting the browser object to load your generated page (generate it to
> disk and point the browser to it, etc.)
>
> Paul T.
>
> "badzio" wrote:
> > I didn't find any method to tell WebBrowser what's the root. file://
> > didin't help.
>
> > On 13 Sty, 20:02, Paul G. Tobey [eMVP] <paultobey _at_ earthlink _dot_
> > net> wrote:
> > > Wouldn't that need to be "file://temp/image.png" or something like that?  The
> > > problem is likely to be that the WebBrowser doesn't know what the root path
> > > from which the HTML was loaded is, so it can't interpret \temp\image.png.  
> > > That is \ related to where?  What server?  There might be some way to tell
> > > the WebBrowser object that information before you set up the document text, I
> > > suppose...
>
> > > Paul T.
>
> > > "badzio" wrote:
> > > > Hi,
>
> > > > I've new problem with WebBrowser :)
> > > > I generate html document at runtime and display it in webbrowser using
> > > > code:
> > > > WebBrowser webbrowser;
> > > > String myHtmlDoc;
> > > > webbrowser = new WebBrowser();
> > > > myHtmlDoc = @"<html>message to display <img='\temp\image.png' \></
> > > > html>";
> > > > webbrowser.DocumentText = myHtmlDoc;
>
> > > > the result is:
> > > > I see text 'message to display' but instead of image I see 'red X' -
> > > > you know, the image which is shown when browser cannot find the image
> > > > to display.
> > > > Ofcourse path \temp\image.png is valid, this file exists.
> > > > If I create a document on the device with mentioned content and load
> > > > it to webbrowser (using Navigate()) than image is displayed.
> > > > If I use image from network:
> > > > myHtmlDoc = @"<html>message to display <img='http://server/image.png'
> > > > \></html>";
> > > > than the image is displayed.
> > > > Seems that in DocumentText cannot contain reference to image on the
> > > > device. Does anybody know how to solve that problem?
> > > > .
>
> > .