473,594 Members | 2,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I save a text file?

I have a simple JavaScript application that will generate some text type
data for the end user. Is it possible to have a button that will allow them
to save this information to a text file?

Thomas
Mar 31 '06 #1
11 18984
Thomas Magma wrote on 31 mrt 2006 in comp.lang.javas cript:
I have a simple JavaScript application that will generate some text
type data for the end user. Is it possible to have a button that will
allow them to save this information to a text file?


Not clientside with normal security settings.
The client's hard-disk is out of reach, and should be so.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 31 '06 #2
>
Not clientside with normal security settings.
The client's hard-disk is out of reach, and should be so.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


I agree that giving webpages the ability to read or write to the harddrive
would be a security nightmare. I'm just wondering on the best approach to
allowing a end user the ability to save information processed by JavaScript.
Aside from taking a picture of his monitor. I guess one option is to write
the information to a large text box where an end user can simply copy and
paste it to his own text file. Anyone know of any other methods of saving
text data?

Thomas

Mar 31 '06 #3
Thomas Magma wrote on 31 mrt 2006 in comp.lang.javas cript:

Not clientside with normal security settings.
The client's hard-disk is out of reach, and should be so.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


I agree that giving webpages the ability to read or write to the
harddrive would be a security nightmare. I'm just wondering on the
best approach to allowing a end user the ability to save information
processed by JavaScript. Aside from taking a picture of his monitor. I
guess one option is to write the information to a large text box where
an end user can simply copy and paste it to his own text file. Anyone
know of any other methods of saving text data?


Javascript can fill the clipboard,
so the user only has to paste it in an editor or MS-Word, and save that.

<textarea id='keep'>Text to be copied</textarea>

function copyer(){
var keep = document.getEle mentById('keep' )
var myObj = keep.createText Range();
myObj.execComma nd("Copy");
}

Not tested. IE only I think.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 31 '06 #4
Thomas Magma wrote:
I have a simple JavaScript application that will generate some text type
data for the end user. Is it possible to have a button that will allow
them to save this information to a text file?


I must have answered that question about 10 times now here.
PointedEars
Mar 31 '06 #5
Jim

Thomas Magma wrote:
I have a simple JavaScript application that will generate some text type
data for the end user. Is it possible to have a button that will allow them
to save this information to a text file?


<!-- VBSCRIPT CODING: WORKS ONLY ON MSIE (??)-->
<!-- IT ALSO TRIGGERS AN ALERT TO AUTHORIZE ACTIVE X TO RUN -->
<script type='text/vbscript'>
'html code: <button onClick="cFi( )">Save to C Drive </button>
'set variables:
Dim objFSO, objTextFile
Dim thecode
'start function triggered onClick of button:
Function cFi( )
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set objFSO = CreateObject("S cripting.FileSy stemObject")

'text file is local drive and file to create that holds the data:
Set objTextFile = objFSO.CreateTe xtFile("c:\html-code.txt", True)

'thecode variable contains the data n your form you want to save to the
file:
thecode = newWin.document .myform.ta.valu e
objTextFile.Wri teLine(thecode)
objTextFile.Clo se
End Function
</script>

Mar 31 '06 #6
>
I must have answered that question about 10 times now here.
PointedEars


Care to make it eleven?
Mar 31 '06 #7
Thomas Magma wrote:
I must have answered that question about 10 times now here.


Care to make it eleven?


No. (E.g.) Google is your friend. [psf 6.1]
PointedEars
Mar 31 '06 #8
In article <O%dXf.207609$H %4.1942@pd7tw2n o>, "Thomas Magma" <so*******@over therainbow.com> wrote:

Not clientside with normal security settings.
The client's hard-disk is out of reach, and should be so.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


I agree that giving webpages the ability to read or write to the harddrive
would be a security nightmare. I'm just wondering on the best approach to
allowing a end user the ability to save information processed by JavaScript.
Aside from taking a picture of his monitor. I guess one option is to write
the information to a large text box where an end user can simply copy and
paste it to his own text file. Anyone know of any other methods of saving
text data?

Thomas


Without any fancy solutions, I just have javascript post it to a form field
and email it to them from the form. That way they get a hard copy and can do
what they want with it.

Larry L
Mar 31 '06 #9
>
Without any fancy solutions, I just have javascript post it to a form
field
and email it to them from the form. That way they get a hard copy and can
do
what they want with it.

Larry L


That's a neet idea. I will consider this.

Thanks
Thomas
Mar 31 '06 #10

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

Similar topics

6
3535
by: BadOmen | last post by:
I have a text file that I want to save from my program. But I don't want to save the empty lines. I want to delete everything after the last character, Is that possible? Then when I read the text file i don't want to read empty lines(If the user as edit the file in notpad..), sense it makes commas at all new lines and then split the text at every comma in to an array. The array will contain empty "slot's" if there is a lot of commas in a...
3
1969
by: Newbie | last post by:
I am trying to get the save/open dialog figured out. I am able open the save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below is what I have code so far. Dim phonestreamwriter As StreamWriter Dim responsedialogresults As DialogResult SaveFileDialog1.InitialDirectory = Application.StartupPath responsedialogresults = SaveFileDialog1.ShowDialog
2
13082
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0" encoding="UTF-8"?><a>some info</a>"; I want to save this xml file to local file system with JavaScript,
0
6422
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags. eg., <table cellSpacing=0 cellPadding=0 width="100%" align=center border=0> <TBODY> <tr> <td width="48%"></td> <td...
4
3706
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
8
2679
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they choose) on the users / client file system. I have toyed with a Self-Extracting zip file but the contents of my zip file changes each time it is downloaded so that invalidates the exe file. Also the text file is so small it is a waste to zip it.
10
4339
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too, but when i try to put an IF in it to check if the file has already been saved before, it will not save.
4
6255
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
2
9605
by: nuhura01 | last post by:
Hi.. I'm trying to save query path which is in text box to text file. Below is the coding that i'm using currently: Private Sub SaveQueryPath() 'save to text file Response.Clear() Response.Buffer = True Response.AddHeader("content-disposition",
3
7136
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this file but save it as an excel file. The data in this excel file will be imported into an Access database. The
0
7877
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8009
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6661
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 project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.