cloudhead
cloudhead

Reputation: 15353

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.. and using something like the above doesn't let me access the contents of the file..

Upvotes: 0

Views: 402

Answers (2)

Tim
Tim

Reputation: 7056

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.

Upvotes: 1

SLaks
SLaks

Reputation: 888117

Assuming that your page is also on the local disk, you should be able to use XHR with a file:// URL.

Upvotes: 1

Related Questions