Loading a file from the browser, without a web server
So I need to load a file from disk somehow, and access its contents.. Sort of like how
<link rel="stylesheet">
works. Is there a way to do this? XHR requires a web server.. an开发者_如何学God using something like the above doesn't let me access the contents of the file..
Assuming that your page is also on the local disk, you should be able to use XHR with a file://
URL.
Do you mean loading from a CD or the HDD? You'll need the full address that it is stored at, for example, something on the desktop would be:
"file:///c:/documents%20and%20settings/user/desktop/file.css"
%20 means a space.
精彩评论