skafy Posted October 10, 2022 Posted October 10, 2022 Hi, I wonder how is it possible (if it is) to show content of one x folder in browser. I tried to use label with <a href> with following lines <a href="C:\FB6\">Link text</a> <a href="file:///C:FB6/">Link text</a> It just starts processing and than "page crash" - timeout & refresh button shown In browser console it says - Prevented navigation to “c:\FB6\” due to an unknown protocol. How can this be done? If I enter file path manualy in new tab it works - like shown below. Quote
skafy Posted October 13, 2022 Author Posted October 13, 2022 Is it possible or not? Nobody knows? Quote
Sherzod Posted October 13, 2022 Posted October 13, 2022 Hello, Your case is not very clear. Where do you want to open, in a separate tab? Quote
skafy Posted October 13, 2022 Author Posted October 13, 2022 43 minutes ago, Sherzod said: Hello, Your case is not very clear. Where do you want to open, in a separate tab? Yes in a sepetate tab. Bellow code example also don't work. UniSession.AddJS('window.open(twAttachmentList.Selected.Text +'?fake='+dt+'")'); Quote
Sherzod Posted October 13, 2022 Posted October 13, 2022 18 minutes ago, skafy said: Bellow code example also don't work. 52 minutes ago, Sherzod said: This is not allowed anyway I guess. Quote
picyka Posted October 13, 2022 Posted October 13, 2022 If I understand correctly, you need to view files from the server in the browser. I did something similar, but I did it with an api Sorry if I'm wrong. Quote
Ron Posted October 13, 2022 Posted October 13, 2022 Check out the HTML5 File API https://jenkov.com/tutorials/html5/file-api.html Quote
skafy Posted October 14, 2022 Author Posted October 14, 2022 16 hours ago, picyka said: If I understand correctly, you need to view files from the server in the browser. I did something similar, but I did it with an api Sorry if I'm wrong. Yes I need to view files from shared folder. It seems like I cannot open new tab with folder view. Also found this..https://stackoverflow.com/questions/18246053/how-can-i-create-a-link-to-a-local-file-on-a-locally-run-web-page Quote You cannot cross from http(s) to the file protocol Modern versions of many browsers (e.g. Firefox and Chrome) will refuse to cross from the http(s) protocol to the file protocol to prevent malicious behaviour. This means a webpage hosted on a website somewhere will never be able to link to files on your hard drive. You'll need to open your webpage locally using the file protocol if you want to do this stuff at all. How did you did it with API? Quote
Ron Posted October 14, 2022 Posted October 14, 2022 13 hours ago, skafy said: How did you did it with API? Due to security reasons the user has to select the files first. Quoting from above source: Quote Before the HTML5 file API can access a file from the local file system, the user has to select the file to give access to. For security reasons selecting files is done via the <input type="file"> HTML element. Here is an input element example: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.