Can We read client side files using javascript? not only text files
Can We read client side files using javascript
Collapse
This topic is closed.
X
X
-
parveenTags: None
-
Thomas 'PointedEars' Lahn
Re: Can We read client side files using javascript
parveen wrote:Can We read client side files using javascript? not only text files
privileged script. In MSIE 7+ you are required to use the ActiveXObject
object instead of XMLHttpRequest for that.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
-
Joost Diepenmaat
Re: Can We read client side files using javascript
parveen <k.parveen@gmai l.comwrites:
Can We read client side files using javascript? not only text files
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Comment
-
Thomas 'PointedEars' Lahn
Re: Can We read client side files using javascript
Thomas 'PointedEars' Lahn wrote:parveen wrote:>Can We read client side files using javascript? not only text files
Yes, with XHR, but only from a file: URI to a file: URI, or with a
privileged script. In MSIE 7+ you are required to use the ActiveXObject
object instead of XMLHttpRequest for that.
Fx 2.0.0.13 if the supporting feature is enabled[1]:
try
{
netscape.securi ty.PrivilegeMan ager.enablePriv ilege("Universa lBrowserRead");
netscape.securi ty.PrivilegeMan ager.enablePriv ilege("Universa lFileRead");
var x = new XMLHttpRequest( );
x.open("GET", "file:///C:/AUTOEXEC.BAT", true);
x.onreadystatec hange = function() {
if (x.readyState == 4) window.alert(x. responseText);
};
x.send(null);
}
catch (e)
{
e
}
It is important that both privileges are requested and granted. Firebug
then still displays
| Security Error: Content at http://... may not load or link to
| file:///C:/AUTOEXEC.BAT.
but the content of the file is displayed anyway. Code running out of the
sandbox does not have to request the privileges though, so be careful with
what extensions you install :)
PointedEars
___________
[1]
The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Comment
-
Thomas 'PointedEars' Lahn
Re: Can We read client side files using javascript
The Magpie wrote:Thomas 'PointedEars' Lahn wrote:>parveen wrote:>>Can We read client side files using javascript? not only text files
>privileged script. In MSIE 7+ you are required to use the ActiveXObject
>object instead of XMLHttpRequest for that.
>>
the files are as long as they are text-content (not binary).
PointedEars
Comment
Comment