Html link to local folder in Windows

hello forum people,
I wanted to know how you can create a link to a local folder on windows using hmtl as the image that I attached (see list of files and be able to download them).
I have seen several things like configuring setings.js (// httpadmin and / httpstatic) but it does not seem to work(or something I did wrong).

what I'm trying (also attached code) has
the problem when I use "href = file: /// <c: user / folder / etc>" when accessing the link, "Not allowed to load local resource:" appears in the browser. Or a tab appears -> about:blank#bloqued

Im using chrome and windows

image

[{"id":"199b5ffd.86c6b","type":"http response","z":"c342a78c.d80538","name":"","statusCode":"","headers":{},"x":870,"y":1080,"wires":[]},{"id":"dbd3f1de.e5f75","type":"http in","z":"c342a78c.d80538","name":"","url":"/LocalVideosTest2","method":"get","upload":false,"swaggerDoc":"","x":280,"y":1080,"wires":[["806c49a6.e81158"]]},{"id":"d2e598cf.6e6058","type":"template","z":"c342a78c.d80538","name":"html page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<head >\n\n        \n<h2><br/><a href=\"file:///{{payload}}\" >LINK</a></h2>\n\n    \n</head>\n{{{also}}}\n<script> function NEW(){window.open(\"{{payload}}\")}</script>\n      \n\n  <body onload=\"NEW()\">\n\n</body>","output":"str","x":680,"y":1080,"wires":[["199b5ffd.86c6b"]]},{"id":"806c49a6.e81158","type":"function","z":"c342a78c.d80538","name":"","func":"\nvar directorio= \"C:\\\\users\";\n\nmsg.payload= directorio\n\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":1080,"wires":[["d2e598cf.6e6058"]]}]

Is not allowed, it is security limitation. You need to make it available on a webserver instead.

That is correct, you cannot mix an http delivered resource with a local one.

You have a couple of options.

  • Make Node-RED write html to a file that you load locally rather than via Node-RED's ExpressJS server.
  • Point the httpStatic setting to the folder so that it will load resources via Express.

Either way, Node-RED doesn't include the creation of an automatic file index page. So you will need to hack that together.

You could use my new node-red-contrib-static-markdown node which will let you point it at your folder in case you are already using the built-in Node-RED static server. It serves static files as well as Markdown. Still doesn't produce an auto-generated index list though - it was on my list of ideas to add.