开发者

Loading a file from the browser, without a web server

开发者 https://www.devze.com 2022-12-27 22:08 出处:网络
So I need to load a file from disk somehow, and access its contents.. Sort of like how <link rel=\"stylesheet\">

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号