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