HTML5 is great and I can replace my existing desktop application with it, but just a little security restriction prevents me to complete my job. I plan to create a simple desktop application completely with HTML5 so it can run on any mobile and desktop devices that support HTML-5.
I know about the browser security on local file and the reason behind it, but I don’t know why I couldn’t find a way to grant read-only access to a folder as sandbox. My application does not need to write a file or even does not need to read a file outside of It main html folder. It needs to read the local file just in same folder same as it do on domain.
So please let me know:
Can run browser with specific command to force it grant access to local file that exists in same folder of HTML? It should not disable all local security restriction just grant HTML access to file in same folder or subfolder.
Is it cross platform method to map a local folder as local host that work on mobile platforms?
Is there any manifest file exists to put in folder to grant read access in same HTML folder?
Is there any way to grant read-only access to a folder as sandbox?
Note: I don't want use third party solution such as XULRunner, Mozilla Prism, Adobe Air or any other third party, I need HTML-5 solution to be cross platform if there is any.
Any idea is welcome.
If you need that file so much, why not just load it dynamically inside a JS script as a json object.
So, in other words, put the contents of the file into a js script, and strucutre the file contents into JSON format, then load that script on load or when you require it.
Alternately if you need file IO use localstorage.
according to this site, launching chrome from the cmd with the parameter --allow-file-access-from-files will disable this security feature
Related
I have read several docs of restriction of browsers for JavaScirpt and questions such as question from stackoverflow, user selected access for local files. Eventually, I have found out that there is no way to full access to build one-user-spa applications using Vue js, and it is true that the browsers must have restriction for JavaScript due to security when the script is download from remote server. But in my case, I want that my application is run locally (all scripts files must been in local computer) by one user and there aren't any security restriction for script. For example, my script must have full access local files and folders to manage local data base like sqlite. How can I do that?
I have a ASP.MVC app running in my company's domain. I would like to make links to Word, Excel or even to folders. For example I would like to allow user to access a project folder on public drive or Office document. Files and web app are on different servers, but in same domain.
The problem is that all modern browsers block access to local files. (Chrome throws an error saying "Not allowed to load local resource: file://..."). IE we are currently still using does allow that, but I can't rely on this.
How to tell the browser that it is safe to open those links?
I read about an option to serve .url files to user with link to file/folder. The downside is that I'd fill users temp folders with .url files. And also while I was testing this, I couldn't make changes to .url file after I saved it. Even removing the file doesn't help. It looks like windows stores it somewhere.
Another option was to make an a-tag with href like "data:text/plain;charset=utf-8..." and offer user to download .url file that way. But it was somehow not working for me.
Please help.
Thank you.
I have a chrome extension (intended to be used by companies internally) that needs to have user specific configurations but I want to avoid the user having to do all that and have a sysadmin configure those things for them via a script.
EDIT: Basically, I just need to read from a file that sysadmin can write.
Is this in any way possible?
You have two solutions.
First one is to ask your sysadmin to properly locate chrome's extension folder on all platforms, and edit a file in there. It might be a bit complicated if all computers at your company are not the same or use different platforms.
See: Where to find extensions installed folder for Google Chrome on Mac?
The second one, is simply to ask for the file:///* permission when you install the extension.
It will allow your extension to read files on the whole hard drive, and load the configuration file on a predetermined place.
Here is a related question:
Chrome plugin reading text file on hard drive and replacing textbox content
edit: for the second solution to work, you need your users to enable "Allow access to file URLs" in chrome's config (not sure you can do that automatically)
Assuming you have an enterprise install, you can use chrome.storage.managed (which can be easily controlled from a central location) to hold those preferences.
See Configuring Apps and Extensions by Policy for a detailed, per-OS explanation.
If an enterprise managed storage is not an option, perhaps a better one would be to have a configuration file available somewhere on an internal web server. The extension can then retrieve that pre-defined URL and configure itself accordingly.
You can differentiate between computers automatically using IP/MAC address information accessible by the server processing the request, of you can pass some query parameters yourself.
How to access path of a folder instead of a file using Ext.form.field in extjs. Is it possible at all in extjs.
I can use the component above but its giving me only the file name without the path to the file.
Or should I use third party tools like jquery or maybe dynamic html/ plain js?
There's no way to get any information on the client's filesystem using a website, for security reasons. Nor Javascript, nor PHP...
Thus, you can't get the path of a client's file.
However, you can do it with a non-website application, installed on his computer.
You could use a java, flash, or activex control to do that.
You could also host extjs inside Sencha Desktop Packaging, ie in an installed executable with an embedded browser.
You might be able to get folder access with HTML5, but that would only be a folder local to your domain and heavily restricted.
Otherwise, browser file/folder security restrictions exist for good reason and you should consider files off limits other than upload/download.
how can you retrieve the data from a document with javascript that isn't the page you are on if you have the url of the new document.
what i am trying to do is create a page that has a text field for providing a local file name and a button that retrieves the words from the document provided.
thanks.
HTML5 has a File API that lets you read local files. It's supported in at least Firefox (3.6 and later, I think) and Chrome. I don't know if any other browsers support it yet or not. If you need to support other browsers, you'll have to fall back to something like Flash, but I don't have any experience with that.
Unfortunately, by default Chrome doesn't allow local files to access other local files (each file is considered to be from its own domain). You can explicitly allow it by adding the --allow-file-access-from-files flag when you launch Chrome.
Here's a good introduction to the File API with several examples: http://www.html5rocks.com/en/tutorials/file/dndfiles/.
Browser security does not allow direct access to the local filesystem. If it could, web pages would be able to steal any file of your machine.
HTML5 local storage does allow local access, but on a different principle.