473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

File I/O

This may be simple but as a JavaScript beginner I am having trouble writing
and saving to a file.

I am trying to use the Google AJAX search API. Within a
<script type="text/javascript" ...I have a searcher for GwebSearch.
Once executed I assign

var result = searcher.results[i];

I then

alert(result.url);

(all properties of the searcher are not important here).

My question is how to save the result.url to a file instead of sending
to the screen. I guess it comes down to doing File I/O within JavaScript.

If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.

Thank you.

- Andrew M. Neiderer
Jan 25 '07 #1
6 2615
Andrew Neiderer wrote:
If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.
Script run within the browser sandbox has no file system access with
normal security settings.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 25 '07 #2
Martin Honnen wrote:
Andrew Neiderer wrote:
>If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.
Script run within the browser sandbox has no file system access with
normal security settings.
In plain English, there is no way to write to a user’s system. Ifyou
need to save a file, you should use AJAX and have a service on the web
server interact with your JavaScript, so that data can be dynamically
saved by the JS for that user in that session. From there, you can have
the file “download” to the user’s system. However, the user still has to
approve this action (it cannot be automated).

In other words, the JS passes the data to the web service that is
running on the web server, and the web server can then do what it wants
with that data, including providing it to the user as a download.

I hope this helps.
...Geshel
--
************************************************** *******************
My e-mail address is an automatically monitored spam honeypot. Do not
send e-mail there unless you wish to be reported as a spammer. Please
send e-mail to my first name at my last name dot org.
************************************************** *******************
Jan 25 '07 #3
Neo Geshel said the following on 1/25/2007 1:32 PM:
Martin Honnen wrote:
>Andrew Neiderer wrote:
>>If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.

Script run within the browser sandbox has no file system access with
normal security settings.
In plain English,
And what exactly in Martin's reply wasn't "plain English". It was quite
plain.

there is no way to write to a users system. If you
need to save a file, you should use AJAX and have a service on the web
server interact with your JavaScript, so that data can be dynamically
saved by the JS for that user in that session.
In "plain English", using AJAX to save a file locally is a stupid way to
do it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 25 '07 #4
Randy Webb wrote:
Neo Geshel said the following on 1/25/2007 1:32 PM:
>Martin Honnen wrote:
>>Andrew Neiderer wrote:

If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.

Script run within the browser sandbox has no file system access with
normal security settings.
In plain English,
And what exactly in Martin's reply wasn't "plain English". It was quite
plain.
Some people that I know that do web sites (for a hobby, mind you) think
that a sandbox is what children play in. Pair it with “browser”, and
you’ve just caused their eyes to glaze over.

Martin’s reply was techspeak. Light techspeak to be sure, but farfrom
“plain English”.
there is no way to write to a user�s system. If you
>need to save a file, you should use AJAX and have a service on the web
server interact with your JavaScript, so that data can be dynamically
saved by the JS for that user in that session.
In "plain English", using AJAX to save a file locally is a stupid way to
do it.
So where is your recommendation?

If you’re going to bash someone about their methods, back it up with a
method that’s “better”, at least in your opinion.Otherwise you’re just
a loudmouthed boor at best, and an idiot at worst.

Cheers.
...Geshel
--
************************************************** *******************
My return e-mail address is an automatically monitored spam honeypot.
Do not send e-mail there unless you wish to be reported as a spammer.
Please send all e-mail to my first name at my last name dot org, with
a subject-line of “NEWSGROUP REPLY FOR NEO GESHEL” (all uppercase).
************************************************** *******************
Jan 26 '07 #5
Lee
Neo Geshel said:
>
Randy Webb wrote:
>Neo Geshel said the following on 1/25/2007 1:32 PM:
>>Martin Honnen wrote:
Andrew Neiderer wrote:

If someone advise, or better yet point me to an example where file I=
/O
>>>>is done within a HTML <scriptit would be greatly appreciated.

Script run within the browser sandbox has no file system access with =
>>>normal security settings.

In plain English,
=20
And what exactly in Martin's reply wasn't "plain English". It was quite=
=20
>plain.

Some people that I know that do web sites (for a hobby, mind you) think=20
that a sandbox is what children play in. Pair it with =E2=80=9Cbrowser=E2=
=80=9D, and=20
you=E2=80=99ve just caused their eyes to glaze over.
Within the context of this newsgroup, there's nothing overly techinical
about "browser". The word "sandbox" is a metaphor for any restricted
area of operation. It's use is not restricted to techspeak.

> there is no way to write to a user=EF=BF=BDs system. If you
>>need to save a file, you should use AJAX and have a service on the web=
=20
>>server interact with your JavaScript, so that data can be dynamically =
>>saved by the JS for that user in that session.=20
=20
In "plain English", using AJAX to save a file locally is a stupid way t=
o=20
>do it.
=20

So where is your recommendation?

If you=E2=80=99re going to bash someone about their methods, back it up w=
ith a=20
method that=E2=80=99s =E2=80=9Cbetter=E2=80=9D, at least in your opinion.=
Otherwise you=E2=80=99re just=20
a loudmouthed boor at best, and an idiot at worst.
He told you that there's no way to write to a user's system.
That sort of absolves him from having to provide a method,
don't you think?

By the way, quoted-printable is a poor choice for posts to USENET.
--

Jan 26 '07 #6
Neo Geshel said the following on 1/26/2007 3:41 PM:
Randy Webb wrote:
>Neo Geshel said the following on 1/25/2007 1:32 PM:
>>Martin Honnen wrote:
Andrew Neiderer wrote:

If someone advise, or better yet point me to an example where file I/O
is done within a HTML <scriptit would be greatly appreciated.

Script run within the browser sandbox has no file system access with
normal security settings.

In plain English,

And what exactly in Martin's reply wasn't "plain English". It was
quite plain.

Some people that I know that do web sites (for a hobby, mind you) think
that a sandbox is what children play in. Pair it with “browser”, and
you’ve just caused their eyes to glaze over.
Then maybe they should spend an hour or so on Google and learn some
things about the hobby they have chosen to partake.
Martin’s reply was techspeak. Light techspeak to be sure, but far from
“plain English”.
No, it was quite plain. You have no access in a default security
environment to save to the local file system from a webpage. Now, are
you going to glaze eyes over with people thinking that "environment" is
the confines of the space you live in?
> there is no way to write to a user�s system. If you
>>need to save a file, you should use AJAX and have a service on the
web server interact with your JavaScript, so that data can be
dynamically saved by the JS for that user in that session.

In "plain English", using AJAX to save a file locally is a stupid way
to do it.

So where is your recommendation?
Considering that you can't do what was asked - in a default security
environment - then there isn't much to recommend other than to say "Find
some other way to make your page works that is feasible".
If you’re going to bash someone about their methods,
I didn't bash you, I called the idea stupid and it still is.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 28 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
3
by: Shapper | last post by:
Hello, I created a script to upload a file. To determine the file type I am using userPostedFile.ContentType. For example, for a png image I get "image/png". My questions are: 1. Where can...
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
0
by: thjwong | last post by:
I'm using WinXP with Microsoft Visual C++ .NET 69462-006-3405781-18776, Microsoft Development Environment 2003 Version 7.1.3088, Microsoft .NET Framework 1.1 Version 1.1.4322 SP1 Most developers...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.