"not allowed to load local resource"

I’m trying to open a new tab in my browser to view a locally stored html file.
I can get this to work using the depracated method

public void open(Resource resource, String windowName, boolean tryToOpenAsPopup)

But not when I try the suggested alternative, which seems to be to provide the open method with a string:

getUI().getPage().open(“file:///” + “path to my file”, “_blank”);

This just results in an error in chrome that it can’t load the local resource, and I get a similar error in FireFox.
The file is stored on the C: and can’t be copied into the java source folder.
It’s not an error with the path as far as I can tell- this opens when I print it and copy and paste it into the browser.
Any ideas how I can get around this?


not sure if it will work, but have you tried the BrowserWindowOpener extension?


Thanks for the reply- I appreciate this goes beyond what I asked in the original question, but the issue is that I’m trying to have a button in a grid that when clicked opens a locally stored html.
I can get the BrowserWindowOpener extension to work when creating a button like this:-

    File localFile = new File(getController().getProperty("resource_path"));
    FileResource resource = new FileResource(localFile);
    Button newWindow = new Button("Open File");
    BrowserWindowOpener opener = new BrowserWindowOpener(resource);

However, I don’t know how to get this to work from inside the grid.
At the moment I have something like below, but, being new to Java, I don’t understand how/if I can then add the browser window opener:-

getColumn(“File To Open”).setRenderer(new ButtonRenderer(…add the BrowserWindowOpener here…));

Any help would be appreciated.
Best wishes,


I think you need a custom Renderer. It could be an extension of ButtonRenderer, but you’d need to add the code from BrowserWindowOpener to do the window opening.


Another option would be to use a ComponentColumn, but remember that you can’t add a BrowserWindowOpener to a button in a click handler - the original click needs to open the window (because of popup blocking in browsers), and on the server side it’s already too late.