Questions tagged [file-uri]

The file URI scheme is a URI scheme specified in RFC 8089 (previously, RFC 1630 and RFC 1738), typically used to retrieve files from within one's own computer.

A file URL takes the form of

file://host/path

where host is the fully qualified domain name of the system on which the path is accessible, and path is a hierarchical directory path of the form directory/directory/.../name. If host is omitted, it is taken to be "localhost", the machine from which the URL is being interpreted.

Note that when omitting host you do not omit the slash ("file:///foo.txt" is okay, while "file://foo.txt" is not, although some interpreters manage to handle the latter).

Examples:

Unix: file://localhost/etc/fstab
Windows: file://localhost/c$/WINDOWS/notepad.exe

106 questions
450
votes
20 answers

Convert file: Uri to File in Android

What's the easiest way to convert from a file: android.net.Uri to a File in Android? Tried the following but it doesn't work: final File file = new File(Environment.getExternalStorageDirectory(), "read.me"); Uri uri = Uri.fromFile(file); File…
hpique
  • 112,774
  • 126
  • 328
  • 461
195
votes
28 answers

CSS @font-face not working with Firefox, but working with Chrome and IE

The following code works in Google Chrome beta as well as IE 7. However, Firefox seems to have a problem with this. I'm suspecting it to be a problem of how my CSS files are included, cause I know Firefox is not too friendly about cross-domain…
Kaushik Gopal
  • 6,880
  • 12
  • 51
  • 69
78
votes
6 answers

File Uri Scheme and Relative Files

Assume that the scheme for a uri is "file". Also assume that the path starts with '.' An example path is './.bashrc'. How would the fulluri look? 'file://./.bashrc' appears odd to me.
user592419
  • 4,535
  • 7
  • 37
  • 64
69
votes
9 answers

HTML 5 Geo Location Prompt in Chrome

Just starting to get into HTML 5 and an testing out geo location...liking it so far. I am hitting a bit of a speed bump though...when I try to get my geo location, chrome automatically blocks the page from getting my location. This does not happen…
AGoodDisplayName
  • 5,257
  • 7
  • 32
  • 49
44
votes
5 answers

How to specify a local file within html using the file: scheme?

I'm loading a html file hosted on the OS X built in Apache server, within that file I am linking to another html file in the same directory as follows: This works. However (for…
Gruntcakes
  • 36,166
  • 41
  • 170
  • 346
37
votes
4 answers

An URL to a Windows shared folder

Is there a way to incorporate a working link to a Windows shared folder into an HTML page? E.g. a link to \\server\folder\path? For simplicity, let's say the page will be opened on a Windows machine (and on the same intranet where the server is…
alex
  • 835
  • 1
  • 7
  • 9
26
votes
2 answers

Javascript/HTML Storage Options Under File Protocol (file://)

I am developing an html application that is essentially a series of pages like a book. Within this application, I would like to store several JavaScript variables across pages. Think things like pages read, bookmarks, etc. When this application is…
Bart
  • 6,378
  • 5
  • 40
  • 52
26
votes
1 answer

What is the Vagrant syntax for adding a locally existing VDI?

What is the syntax for adding a locally existing VirtualBox .vdi to vagrant? There doesn't appear to be an example of alternate URI schemes in the documentation. Can it also use ssh and httpauth locations?
vfclists
  • 16,968
  • 18
  • 63
  • 88
16
votes
1 answer

file: URIs and Slashes

An application I'm working on involves accessing files on network file shares, and we're using URIs to specify the files' locations. My understanding of the file: URI is that they should take the form of file://+path. In the case of a Windows…
Sammy1Am
  • 244
  • 4
  • 11
16
votes
3 answers

Java : File.toURI().toURL() on Windows file

The system I'm running on is Windows XP, with JRE 1.6. I do this : public static void main(String[] args) { try { System.out.println(new File("C:\\test a.xml").toURI().toURL()); } catch (Exception e) { e.printStackTrace(); …
glmxndr
  • 42,138
  • 27
  • 90
  • 115
15
votes
2 answers

URI scheme is not "file"

I get the exception: "URI scheme is not file" What I am doing is trying to get the name of a file and then save that file (from another server) onto my computer/server from within a servlet. I have a String called "url", from thereon here is my…
Ankur
  • 47,089
  • 107
  • 237
  • 309
12
votes
5 answers

How to launch a file protocol URL with an anchor from Java?

From a Java program, I need to launch the default browser on a local HTML file, pointed to an anchor inside the file. In Java SE 6, the java.awt.Desktop.browse method will open the file, but will not honor the anchor, so something like the…
Jeff C
  • 437
  • 4
  • 10
12
votes
5 answers

Read file:// URLs in IE XMLHttpRequest

I'm developing a JavaScript application that's meant to be run either from a web server (over http) or from the file system (on a file:// URL). As part of this code, I need to use XMLHttpRequest to load files in the same directory as the page and in…
Dan Fabulich
  • 31,628
  • 35
  • 121
  • 153
11
votes
2 answers

Local file protocol for java.net.URL

What's the protocol for local files using URL? I've downloaded a file using Java and I need to know how to access it, not using File, but using URL.
Ziddia
  • 347
  • 2
  • 4
  • 9
11
votes
1 answer

Chrome - Fetch API cannot load file. How to workaround?

I have the following two files: index.html Web Page