javascripthtmlfile-permissionspermission-deniedproject-settings

HTML/Javascript: Enabling folder access from a subdirectory


I have a simple HTML file with some JavaScript that I would like to run locally (as opposed to deploying to a server). It is embedded inside a larger project whose file structure I would like to maintain. For example, the structure is something like this:

project level folder > src folder containing folders & files I would like to probe
                     > separate, non-project util folder > HTML & JS files I would like to run against src

I am aware that certain browsers do not allow this for security reasons (as pointed out here), but since I control all of the files - is there a way for the src folder/files to somehow indicate that they will allow the 'separate, non-project util folder' to access them? Maybe some kind of project-specific settings somewhere? I am aware that this can be done in server settings, but as I mentioned above I'd like to be able to run it locally without the need for a server.

The JavaScript that is attempting to access the src files uses RequireJS, in case that helps.


Solution

  • Here is what I ended up doing:

    I wasn't able to provide full access exactly this way, but instead I setup a dummy HTML page in the project level folder that clicks itself to redirect to the HTML file located in the separate, non-project util folder. This allowed me to keep everything but that one, very small file separate but not have issues with file access.