Link to a network hostet ressorce

Hi,

how can open a link to a network hostet ressource? In my case .html and .pdf files.

I have a folder with a lot of .html Files on my fileserver and i want that the user can click on a link element in the grid to open one of them in a new Browser Tab.

Here is one example. Does open totally fine if i put it in Google Chrome manually
file://myfileserver/docs/html/variant0001.html
file://myfileserver/docs/html/variant0001.pdf

Tried this but nothing happens. No failure, no open.
UI.getCurrent().getPage().open(“file://myfileserver/docs/html/variant0001.html”);

Tried this also. Its a link but does nothing.
Anchor linkHTML = new Anchor(“file://myfileserver/docs/html/variant0001.html”, “HTML Version”);

Given the URL you mentioned, I assume the resources are on the same machine that hosts the Vaadin application.
If so, take a look at the Download API, e.g. How to download from server to browser in Vaadin

That does not fit here. I want the .html files to be displayed by the server and not downloaded. We are using high resolution images in this particular case and downloading takes much longer than viewing. Also, I would have to embed the images in the html file, which I don’t want to do as they are referenced from the original location so I don’t have to take up twice the disk space. Sometimes 10-50 html file variants are generated, which is currently only 7KB per file as no embedding is used. If I were to include everything in the html files for all variants that are only generated briefly, I would be at 100MB per html. So 7KB * 50 = 0,5MB VS 5GB with embeddings.

That is technically the same. One is download flag set to true, the other is the inline flag for the browser to render your “requested”/“downloaded” source file

If i use the new Download Handler like this, i have the problem that the picure will not be loaded from the network drive.

Anchor openHtmlInNewTab = new Anchor(DownloadHandler.forFile(new File(fileHtml)).inline(), AttachmentType.INLINE, "HTML Version - Print");
        openHtmlInNewTab.setTarget("_blank");
HTML file 
....
<div style="margin-bottom:1.5rem!important;">
			<img src="\\myfileserver\Files\projectpictures\30\030.jpg" alt="Projektpicture" style="width:100%; max-height:500px; object-fit:cover; object-position:top;"/><br></br>
			<p style="margin-top:6px; font-size: 12px; color:#888383;">3D Rendering</p>
        </div>
....