local file access? fread? fopen?

W

weinjared

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

thanks,
jared
 
T

Tim Slattery

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

Under a normal security environment, no. So if you're writing a page
for general usage, you CANNOT do this (and I don't want your page
messing around my file system anyway)!
 
D

Dr J R Stockton

In comp.lang.javascript message <c2b7e491-9255-481e-bf9e-1e7e794b1bd9@a1
2g2000pro.googlegroups.com>, Tue, 16 Dec 2008 08:20:15,
(e-mail address removed) posted:
is it possible to get local file access from locally run javascript?

Certainly. One can do it much as with VBScript, under WSH; see the
newsgroups.
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

There is of course no necessary security problem there.

Read <http://en.wikipedia.org/wiki/HTA_(programming_language)>; there
should be corresponding Microsoft newsgroups, but I don't know which
they are. You will probably be limited to running IE4+ in windows.
 
W

William James

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

thanks,
jared

If you would consider running JavaScript outside of a
web browser, look at jslibs. It lets SpiderMonkey
read and write files.
 
T

Tim Greer

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

thanks,
jared

If it's in the web path and is reabable, or in the file path if you're
not using a local web service, and is readable, you can, but that's
nothing unusual, it's just basically a link to the file. Otherwise
you'd need some framework to run JS inside of the page run by a web
service, or something similar.
 
J

jhuni

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

thanks,
jared

Check out appcelerator titanium and adobe air. Titanium is gratis and
free software but unfortunately it is not done yet. When it is done it
will be as simple as this: http://titaniumapp.com/documentation/file.
In addition you can always read the handle with XHR and code the
server for handle-writing.
 
B

beegee

Check out appcelerator titanium and adobe air. Titanium is gratis and
free software but unfortunately it is not done yet. When it is done it
will be as simple as this:http://titaniumapp.com/documentation/file.
In addition you can always read the handle with XHR and code the
server for handle-writing.

This is a very cool idea. I downloaded to my Mac and it seems to work
great. The only caveat is that their demo app, though incredibly
simple, uses both JQuery and Prototype. They do state that it is not
neccessary to use either one of these to create a titanium app but the
fact that they think JQuery is "great" technology is disturbing.

Thanks for the link. I will amaze my friends and impress women with
my new ability to create full blown cross platform apps with
javascript.

Bob
 
D

David Mark

This is a very cool idea.  I downloaded to my Mac and it seems to work
great.  The only caveat is that their demo app, though incredibly
simple, uses both JQuery and Prototype.  They do state that it is not

Dear God.
neccessary to use either one of these to create a titanium app but the
fact that they think JQuery is "great" technology is disturbing.

Yes, very disturbing. Cue Twilight Zone music.

[snip]
 
T

Thomas 'PointedEars' Lahn

Tim said:
is it possible to get local file access from locally run
javascript? I'd like to be able to run a local html page and have
it read a local file from the system? Something like fopen but for
javascript. [...]

[...] Otherwise you'd need some framework to run JS inside of the
page run by a web service, or something similar.

"some framework to run JS inside of the page run by a web service"?
That's marketing gibberish.

JFYI: No framework can work around the Same Origin Policy when it comes
to local files.

(This is the second time in a row I see you mentioning a "framework"
as a magical solution of some sort. Why not stick to the things where
you are [hopefully] good at, like selling Web space?)


PointedEars
 
T

Tim Greer

Thomas said:
Tim said:
is it possible to get local file access from locally run
javascript? I'd like to be able to run a local html page and have
it read a local file from the system? Something like fopen but for
javascript. [...]

[...] Otherwise you'd need some framework to run JS inside of the
page run by a web service, or something similar.

"some framework to run JS inside of the page run by a web service"?
That's marketing gibberish.

Enough of your senseless attacks already. There is no reason for this.

Marketing gibberish? Exactly what am I trying to market in my response?
A framework for JS to work in?

Do you know what the term "software framework" means? I guess not. I
gave the OP an answer that they can probably use it normally, with the
appropriate paths (locally or on a remotely hosted site on a web
server), or use it in a web service on their local system. What
exactly is the problem here and your overwhelming urge to do this in
response to each of my posts, all because I happen to mention they can
use other methods _as well_?
JFYI: No framework can work around the Same Origin Policy when it
comes to local files.

Where did _anything_ I said above remotely relate to that or me saying
otherwise?
(This is the second time in a row I see you mentioning a "framework"
as a magical solution of some sort.

This is the second time you've attacked me for no reason for simply
menintiong a (software) framework. What is the problem?
Why not stick to the things where
you are [hopefully] good at, like selling Web space?)

You're out of line and out of control. This is ridiculous.
 
T

Thomas 'PointedEars' Lahn

Tim said:
Thomas said:
Tim said:
(e-mail address removed) wrote:
is it possible to get local file access from locally run
javascript? I'd like to be able to run a local html page and have
it read a local file from the system? Something like fopen but for
javascript. [...]
[...] Otherwise you'd need some framework to run JS inside of the
page run by a web service, or something similar.
"some framework to run JS inside of the page run by a web service"?
That's marketing gibberish.

Enough of your senseless attacks already. There is no reason for this.

There are plenty of reasons for it.
Marketing gibberish? Exactly what am I trying to market in my response?

I don't know what you are trying to market here, but what you said is
the kind of talk that suits do when it comes to market software
development. man bullshit_bingo.
A framework for JS to work in?

Yes, that's gibberish, and your overuse of the term "framework"
indicates that, in fact, you don't know when it is appropriate
to use it.
Do you know what the term "software framework" means? I guess not.

You could not be farther from the truth.
I gave the OP an answer that they can probably use it normally, with the
appropriate paths (locally or on a remotely hosted site on a web
server), or use it in a web service on their local system.

And I did not comment on *that*, did I?
What exactly is the problem here and your overwhelming urge to do this in
response to each of my posts, all because I happen to mention they can
use other methods _as well_?

"To each". That's really funny, coming from someone who has posted only
eight times so far here this week and *ever*, to whose *two* postings I
have happened to comment on. You have to be really strong know: You
can't even begin to imagine the level of your current unimportance here
or in my life.
Where did _anything_ I said above remotely relate to that or me saying
otherwise?

You implied it rather strongly:

| Otherwise [if it's not in the web path but is not readable, or it's
| in the file path but you are using a local Web service; ed.] you'd
| need some framework to run JS inside of the page run by a web service,
| or something similar.

That said, there is a lot of gibberish in that as well, so it is likely
that you have been misunderstood.
This is the second time you've attacked me for no reason for simply
menintiong a (software) framework. What is the problem?

The problem is that so far you have been giving advice that may sound
authoritative to newbies (because of a lot of buzzwords in it) but in
fact you don't appear to have a single clue what you are talking about.
And *that* is unwanted here.

I would grant you that your intentions might be good but that you might
have difficulties with writing understandable English; in that case I
would suggest you use simpler (but nevertheless correct) language instead.
Why not stick to the things where
you are [hopefully] good at, like selling Web space?)

You're out of line and out of control. This is ridiculous.

Yes, you are.


PointedEars
 
T

Tim Greer

Thomas said:
Tim said:
Thomas said:
Tim Greer wrote:
(e-mail address removed) wrote:
is it possible to get local file access from locally run
javascript? I'd like to be able to run a local html page and have
it read a local file from the system? Something like fopen but for
javascript. [...]
[...] Otherwise you'd need some framework to run JS inside of the
page run by a web service, or something similar.
"some framework to run JS inside of the page run by a web service"?
That's marketing gibberish.

Enough of your senseless attacks already. There is no reason for
this.

There are plenty of reasons for it.

Actually, there are not. Just your attitude. I posted to help the OP
and the simple mention of one method to do this drove you up the wall
(both in this thread and another one). Apparently it doesn't matter
how relevant or well intended, you think anyone mentioning the word
"framework" is a marketing tactic and the person needs to be ridiculed.
Personally, I find that behavior rather odd, not to mention
inappropriate.
I don't know what you are trying to market here,

Yet you accused me of rambling on about "marketing gibberish", all
because I effectively said that "one way would be to use a
framework" (to run the JS code inside of). Big deal?
but what you said is
the kind of talk that suits do when it comes to market software
development. man bullshit_bingo.

Not really. I mentioned a simple word, one of many solutions. There's
no reason to fly off the handle and start making wild assumptions. I
could ask why the word "framework" is such a sensitive thing for you,
but I really don't care and you were out of line.
Yes, that's gibberish,

No, it's actually not. There are many ways to run JS code.
and your overuse of the term "framework"
indicates that,

"Overuse of the term"? Really? I mentioned it in THIS thread and in
ONE other thread. Using it twice (when it's relevant) is "overused"?
Just what IS it about that word that sends you up the wall?
in fact, you don't know when it is appropriate
to use it.

It's appropriate at times when it's relevent, on topic and a valid
option. I didn't tell them to do it. I didn't say they had to do it.
I offered it along with some other methods. I didn't even go into any
detail.
You could not be farther from the truth.

Well, it sure seems that way to me, given your reaction.
And I did not comment on *that*, did I?

Yes, you did. By replying directly to me and saying I was spouting off
"marketing gibberish" and claiming I ever said a "framework" is a
"magical solution". The term "framework" means more than you
apparently know, and it's a pretty generic term at that. This is why I
find it odd that you are losing your head about such a generic and
generalized term. Has there been some troll or spammer pushing some
such thing in the group lately? I honestly don't know, I'm geninely
asking. Either way, you simply have no grounds to be treating me the
way you are. I can take it, I just don't see the reason to go back and
forth about it.
"To each".

Yes, "each" (as in both of them where I had mentioned that generic,
general term).
That's really funny,

If you say so.
coming from someone who has posted
only eight times so far here this week and *ever*,

That's funny? I post on dozens of news groups every day offering help
and answers to people. Rarely do I get such a response as yours. So,
I just started posting here, a group I've not really been involved in
previously. Why does that matter, exactly? Is it that you don't
recognize me and deem me as a "regular" member and thus have no rights
to say anything without risking your attempts to ridicule me, all over
a word used that is a general term?
to whose *two*
postings I
have happened to comment on.

Exactly, you couldn't resist and felt the need to attack me. I think
that's strange.
You have to be really strong know: You
can't even begin to imagine the level of your current unimportance
here or in my life.

I care? When did I ever indicate I thought you saw me as important? Do
I need to spell it out? I post, you attack me in response for no
reason, and I might respond to you. Is that unexpected? Why read more
into it than there is? I just fail to see your motivation.
You implied it rather strongly:

"Implied", so you read into what was said how you want, and out of your
interpretation, you find (in your own mind) reason for attack. Again,
that is strange behavior. What should have my response been to hope
you just let it go and move on? I'll make a note for next time.
| Otherwise [if it's not in the web path but is not readable, or it's
| in the file path but you are using a local Web service; ed.] you'd
| need some framework to run JS inside of the page run by a web
| service, or something similar.

That said, there is a lot of gibberish in that as well, so it is
likely that you have been misunderstood.

No gibberish, just that I didn't elaborate or clarify. If anyone was
confused, I'm sorry for that. However, to admittedly say I've been
misunderstood and use that as a rationalization to attack me (someone
you know nothing about), and then continue to do so, is not reflecting
well on you. Also, please note; just accusing someone of talking
"gibberish" (who are you, Mr. T?), isn't a good basis for arguing with
them. In fact, why are you trying to argue about it at all? You're
arguing about what I meant, rather than just reading my reply when I
clarified? All this because of a word. Wow.
The problem is that so far you have been giving advice that may sound
authoritative to newbies

So, I'm not allowed to post here in your view, because it might actually
sound like I'm posting to help them?
(because of a lot of buzzwords in it)

Buzzwords? Hardly. The answer was very generalized because they had
several options and solutions. There's just no way to win with you, is
there?
but in
fact you don't appear to have a single clue what you are talking
about.

Prove it. Because I said they have that option (which they do), you
claim I don't have a clue what I'm talking about. That's a hell of a
view point when someone doesn't agree with you, or you're just too lazy
or maliciously unwilling to read what they said because you prefer to
fight with people (I guess this is your way to play alpha-poster)?
And *that* is unwanted here.

I agree. You're welcome to follow your own advice any time.
I would grant you that your intentions might be good but that you
might have difficulties with writing understandable English;

Looks to me that the issue is simply that it is you that fails to
understand English, and nothing more.
in that
case I would suggest you use simpler (but nevertheless correct)
language instead.

I can't make you keep up. I promise to type slower, if you promise to
read slower.

Why not stick to the things where
you are [hopefully] good at, like selling Web space?)

You're out of line and out of control. This is ridiculous.

Yes, you are.

Indeed you are.

Sorry, I didn't mean to make you feel like I was a threat. Unlike you,
I come on usenet to help people and discuss topics, not try and act
like I own the place and attack new posters you don't recognize for no
reason. Hey, whatever you do, don't change.
 
T

Thomas 'PointedEars' Lahn

Tim said:
No, it's actually not. There are many ways to run JS code.

Now that's interesting. Did you accidentally forgot about those other
ways in the other thread? How convenient.
Yes, you did.

No, I did not. The parts I was not referring to had been snipped, and
the omission had been clearly marked.
By replying directly to me and saying I was spouting off
"marketing gibberish" and claiming I ever said a "framework" is a
"magical solution". [...]

I have neither the time nor am I very much inclined to help you with
your reading and writing problems. Get a life.


Score adjusted

PointedEars
 
T

Tim Greer

Thomas said:
Now that's interesting. Did you accidentally forgot about those other
ways in the other thread? How convenient.

Nope, and I had mentioned in there. How is it interesting at all to you
to want to intentionally make me look bad by making untrue things up?
I guess I am important to you. Do you feel that I am a threat to you
somehow?
No, I did not.

Yes, you did. (hey, this can go on forever).
The parts I was not referring to had been snipped, and
the omission had been clearly marked.

I really don't even know what to say, but I don't think it would make
any difference in helping you anyway.
By replying directly to me and saying I was spouting off
"marketing gibberish" and claiming I ever said a "framework" is a
"magical solution". [...]

I have neither the time nor am I very much inclined to help you with
your reading and writing problems.

Uh huh. It's always the guy that doesn't agree with you, whom happens
to suffer from such ailments. You must be new to the Internet.
Get a life.

Got a mirror?
Score adjusted

Indeed. Glad to see you think this sort of stuff is entertaining. Give
me your address and I'll buy you a game system or something for
Christmas.
 
J

Jorge

is it possible to get local file access from locally run javascript?
I'd like to be able to run a local html page and have it read a local
file from the system? Something like fopen but for javascript.

Yes it is, no problem (from a local .html file loaded using the file:
protocol). Just do an xmlHttpRequest to the local file, from the
local .html. Navigate the filesystem using paths such as "../" or
"../../" (to move out of the .html's folder) etc.
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Actually, there are not. Just your attitude. I posted to help the OP
and the simple mention of one method to do this drove you up the wall
(both in this thread and another one).

Reading this newsgroup for a while before posting would have shown you
what Thomas Lahn and David Mark are like. There appears to be no cure.
Don't waste space arguing in detail; just give them brief occasional
reminders that they should seek appropriate professional advice.
 
J

Jorge

Seems like that XHR stopped working locally sometime in late IE7, or maybe
in IE8.
There might be a preference but I haven't found it.

But works fine in Safari, Opera, Chrome and FF2 & FF3.
 
T

Tim Greer

Dr said:
Reading this newsgroup for a while before posting would have shown you
what Thomas Lahn and David Mark are like. There appears to be no
cure. Don't waste space arguing in detail; just give them brief
occasional reminders that they should seek appropriate professional
advice.

I appreciate the reminder. I've heard this from several people that
have been diplomatic enough to explain to me over private email and
remind me it's common for these two. I've been around for a while,
I've seen it in every group and web site. I'll make sure the annoyance
of this ends shortly, or at least my involvement in it (I don't like
adding to clutter, so they can have the last word or whatever it is
they are aiming for). Cheers!
 
T

Thomas 'PointedEars' Lahn

Joe said:
Seems like that XHR stopped working locally sometime in late IE7, or maybe
in IE8.
There might be a preference but I haven't found it.

Use the usual

new ActiveXObject("Microsoft.XMLHTTP")

(MSHTML 4.0+) instead of

new XMLHttpRequest()

(MSHTML 7.0+ only), then it works from file:// resources to file://
resources as well.

Please provide attribution of quoted text:

<http://jibbering.com/faq/#posting>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top