Accessing local files and folders / open with explorer?
-
Running the plattform on my isolated server and therefore was curious if enabling HTML would allow me to link on local files - basically what's the described in the following link:
open a folder in windows Explorer from html
I write a personal web app to sort my book , film , file , ... . It is just for my use and will not run on server , I wants to write some code in it that for example if I open a book in browser I can
Super User (superuser.com)
However those links just don't seem to work and I am curious what might be the reason for it. Is this a browser topic (since I am still accessing nodeBB via http(s) and while it works fine in plain html it does not within a post ...
Or is there a better way to achieve this?
Edit: The most promising so far is https://chrome.google.com/webstore/detail/local-explorer-open-file/eokekhgpaakbkfkmjjcbffibkencdfkl
However, within nodeBB the following does not work:
<a href="localexplorer:C:\Program Files">Test link localexplorer</a>
nor does
[Test link](localexplorer:C:\Program Files)as the link is just not clickable ... any ideas to make this work?
-
@schajuli look in the developer tools to see what HTML is being emitted. I'd guess it's being sanitized out.
-
Ok, while it seems to be working with Chrome it does not with Firefox
Tried out the following and I am still having the same issues within nodeBB
https://stackoverflow.com/questions/1804604/firefox-open-local-link-to-directory-with-explorerAll links starting with file///: are getting truncated meaning that they are not recognized by the browser anymore. Is there a way to bypass this?
Moreover what I do not understand is that the concept itself is failing as in a plain test html for both browsers the link works, but in nodebb it does not for Firefox, though the link in the sourcecode of the pages in the end is absolutely the same ...
<a href="\\C:\Program Files">This should work</a>
-
What is the exact markdown you're inputting and what is the HTML you see on the resulting page?
-
Well,
actually the following works in plain HTML in both Chrome and Firefox:
<a href="file:///C:\Program Files">Opens Explorer (for both but not in NodeBB)</a>
-> but it does not work within NodeBB
So what e.g. works now within NodeBB (but only in Chrome) is ...
<a href="\\C:\Program Files">This only works with Chrome in nodeBB</a>
... although it also works with Firefox in plain HTML so that was what I wrote in the previous post.
So what's in the source code of the post then:
For the first one it seems like it's sanitized as this removes the href totally ...
so
but the second is a real link ...
... but Firefox refuses to open it although it does in plain html
-
My guess is that any non-http(s) links are being sanitized out for safety. This is likely done by the markdown parser (or perhaps from the markdown plugin).
Enabling HTML and pasting in HTML directly bypasses the markdown plugin, so that is why it doesn't get sanitized out, but it sounds like there's some other quirk that's causing it to render oddly (in such a way that only Chrome can open it).
-
@julian actually it looks like he has tried it with just HTML and it appears that it's actually the built in NodeBB sanitizer.
I'm guessing
\\
works in Firefox when it's from an actual HTML file is because Firefox doesn't protect local files from local access but does prevent that from web access. And Chrome just doesn't have that restriction. -
@julian said in Accessing local files and folders / open with explorer?:
Right. Either way the question is whether we really should be allowing NodeBB to link out to local files. I suppose there isn't any harm in it...
At least to have an option allowing that would be great if that would mean that it should work!
Edit: Also played a bit with the ns-embedd plugin and tried to automatically create a button when local links are posted but it seems like that those links are going to be sanitized as well - not just local links but all of them.