Embedded in Browser-Mode using a html-file from local harddisk doesn't work

I want to use something like this:

       [font=Courier New]
 URL url = new URL("file:/C:/Projects/Project_Connect/connect/doc/Leitungssatzportal/prototype/ffl-web/home.html");
            Embedded e = new Embedded(null, new ExternalResource(url));
            e.setType(Embedded.TYPE_BROWSER);
            e.setWidth("100%");
            e.setHeight("100%");

[/font]

The html page is located on the windows hard disk where my server is also running.

But the page will not shown.

What i am doing wrong?

THANKS!

regards

The syntax for your URL looks wrong. I would expect file:///C:/path since the file is on your own machine (the first // are before the host name, and the third is after the (empty) hostname) . See http://en.wikipedia.org/wiki/File_URI_scheme

i tried a lot of variants already, also this ones:

[font=Courier New]
URL url = new URL(“file://localhost/C:/Projects/Project_Connect/connect/doc/Leitungssatzportal/prototype/ffl-web/home.html”);

URL url = new URL(“file:///C:/Projects/Project_Connect/connect/doc/Leitungssatzportal/prototype/ffl-web/home.html”);
[/font]

Doesn’t work at all…

Any ideas?

How about using a
FileResource
instead?

i also tried this. Then the html was found, but the Embedded does not try to render the file as a webpage. Just the text is displayed, without any styles, etc.

That is odd, this is working for me:


 FileResource resource = new FileResource(new File(
                "/home/john/test.html"), getApplication());
        Embedded embedded = new Embedded(null, resource);
        embedded.setType(Embedded.TYPE_BROWSER);
        embedded.setWidth("100px");
        embedded.setHeight("100px");

Are you sure your Embedded is showing? I see you are using 100% width/height which means the parent needs to define the Embedded’s size. Try setting them to pixels and see if it makes a difference. If it does then append ?debug to your application url and run “Analyze layouts” to see if you have any layouting issues.

Ah, never mind the last answer. I didn’t read your reply thoroughly enough.

If your stylesheets are not rendered then you most likely are either not serving them though the application or the stylesheets path in the html file does not correspond to the real URL. Inline Css styles should work just fine as well.

The webpage is shown. Thanks a lot!

About the style problem i will care later on…