JavaScript 可以存取檔案嗎?

JavaScript

簡介

歷史

開發工具

基本語法

運算式

分枝

迴圈

函數

陣列

物件導向

原型

封裝

繼承

多型

this

控制流程

進階功能

Eval 函數

Closure

JSONP

小書籤

字串

正規表達式

除錯方法

伺服端

播 midi

cookie

套件

ccc函式庫

2D 繪圖

3D 繪圖

影像處理

訊號處理

語音處理

數學計算

tex 數學式

格式轉換

桌面應用

自然語言

地理資訊

平台

Node.js

jQuery

Google

numeric.js

Titanium

引擎

語法

作品

翻譯精靈

繪圖精靈

DotWiki

流程

前端工程師

後端工程師

css

訊息

相關網站

參考文獻

最新修改

簡體版

English

方法一

on Firefox you (the programmer) can do this from within a javascript file:

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite");

and you (the browser user) will be prompted to allow access. (for Firefox you just need to do this once every time the browser is started)

If the browser user is someone else, they have to grant permission.

方法二

Only digitally signed scripts can elevate permissions, otherwise it is just denied (you get something like "A script from "http://darktower.eondream.com" was denied UniversalXPConnect privileges.")

I haven't looked into this on IE yet. I wouldn't be terribly surprised to find a similar situation where only digitally signed code can elevate privileges.

Here is the firefox page about digitally signed scripts: http://www.mozilla.org/projects/security/components/signed-scripts.html


down vote
http://www.mozilla.org/projects/security/components/signed-scripts.html

You need not digitally sign the script, if the user enables signed.applets.codebase_principal_support (In about:config set the value to true)

This is explained in the same page under the heading Codebase Principals

參考文獻

  1. http://stackoverflow.com/questions/371875/local-file-access-with-javascript

Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License