473,394 Members | 2,031 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,394 software developers and data experts.

Can Javascript produce a file?

hello,
I'm thinking about javascript's producing another file.
Can I do it?
Jul 20 '05 #1
3 2666
"mydirac" <my*****@siren.ocn.ne.jp> wrote in message
news:be*********@nn-tk102.ocn.ad.jp...
I'm thinking about javascript's producing another file.
Can I do it?


JavaScript can write files but only indirectly and only in some
environments. From an (unspecified) web browser writing to the client's
files system would be a security violation and is close to being
impossible, certainly not worth the effort.

It should be possible to provide something like a Java applet what would
permit the writing of a file to your server and be scriptable with
JavaScript. Doing so would be massively stupid as such an applet would
be trivial to hijack and you would not want some remote user to be able
to choose to write anything they wanted to your server.

The normal HTML form/HTTP based request to server, sending information
that may be placed in, or added to, a file and server-side scripting to
check that information and then file it, is the only sensible approach
as you get to choose what control to place on what is written to your
server/databases (and the client cannot ascertain any of the details).

Richard.
Jul 20 '05 #2
Thank you, thank you so much for your detailed answer and explanations.
I need to study it deeper.
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:be*******************@news.demon.co.uk...
"mydirac" <my*****@siren.ocn.ne.jp> wrote in message
news:be*********@nn-tk102.ocn.ad.jp...
I'm thinking about javascript's producing another file.
Can I do it?


JavaScript can write files but only indirectly and only in some
environments. From an (unspecified) web browser writing to the client's
files system would be a security violation and is close to being
impossible, certainly not worth the effort.

It should be possible to provide something like a Java applet what would
permit the writing of a file to your server and be scriptable with
JavaScript. Doing so would be massively stupid as such an applet would
be trivial to hijack and you would not want some remote user to be able
to choose to write anything they wanted to your server.

The normal HTML form/HTTP based request to server, sending information
that may be placed in, or added to, a file and server-side scripting to
check that information and then file it, is the only sensible approach
as you get to choose what control to place on what is written to your
server/databases (and the client cannot ascertain any of the details).

Richard.


Jul 20 '05 #3
Hi Richard,

Richard Cornford wrote:
"mydirac" <my*****@siren.ocn.ne.jp> wrote in message
news:be*********@nn-tk102.ocn.ad.jp...
I'm thinking about javascript's producing another file.
Can I do it?

JavaScript can write files but only indirectly and only in some
environments. From an (unspecified) web browser writing to the client's
files system would be a security violation and is close to being
impossible, certainly not worth the effort.

It should be possible to provide something like a Java applet what would
permit the writing of a file to your server and be scriptable with
JavaScript.


Unless I am very mistaken, this is impossible without some kind of
server-side interaction. Applets are able to open direct connections to
the server (in the contrary of JavaScript, which goes through the HTTP
protocol), but it is not enough to allow writing to it. The usual way to
handle this is a pair applet-servlet.
Doing so would be massively stupid as such an applet would
be trivial to hijack and you would not want some remote user to be able
to choose to write anything they wanted to your server.

The normal HTML form/HTTP based request to server, sending information
that may be placed in, or added to, a file and server-side scripting to
check that information and then file it, is the only sensible approach
as you get to choose what control to place on what is written to your
server/databases (and the client cannot ascertain any of the details).

Richard.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #4

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

Similar topics

6
by: Jonny | last post by:
How can you validate Javascript generated HTML for XHTML 1.0 strict compliance? To avoid the "<" and "&" problem, all inline scripts MUST be enclosed with either: <!-- script --> Looked down...
2
by: TeknoCat | last post by:
Hey everyone, I may be repeating myself here, but if someone sent a reply then I missed it, and I can't get Outlook Express to download any messages more than 2 days old. Anyway, I'm having a...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
6
by: KKramsch | last post by:
OK, here's the scenario: I have a CGI script that generates a page with frames (BTW, I'm not crazy about frames, but in this case the decision to use them is out of my hands). In a typical...
5
by: Robin Johnson | last post by:
Hi, I've written an engine in Javascript for running text adventure games on a web page: http://www.robinjohnson.f9.co.uk/adventure/hamlet.html (That's the only game I've written with it so...
6
by: bonehead | last post by:
Greetings, I'm working on an e-mail form (btw many thanks to Philip Ronan for the very cool email address format tester function, best I've seen so far). I've been trying, with limited...
16
by: Phlip | last post by:
Javascripters: I have a page with an iframe inside. Let's say the iframe looks like this: <script src="/javascripts/prototype.js" type="text/javascript" /> .... <iframe id='grinder'...
9
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.