Hello,
I make calculations and many thinks in a page that result in a
javascript table file. I know how to create a CSV string from this
table in JS, but I would like that when the user click on a given
button, the script launchs and generate a file that is dowloadable
using a dialog box without requesting server.
Can you tell me if it is possible and how I can do that ?
This must be compatible with IE6 (and higher) and latest release of
FF.
Thanks a lot for you help !
|
|
0
|
|
|
|
Reply
|
Pif
|
11/26/2009 9:20:43 AM |
|
On Nov 26, 9:20 am, Pif wrote:
> I make calculations and many thinks in a page that
> result in a javascript table file. I know how to create
> a CSV string from this table in JS, but I would like that
> when the user click on a given button, the script launchs
> and generate a file that is dowloadable using a dialog
> box without requesting server.
>
> Can you tell me if it is possible and how I can do that ?
It is not impossible, using data URLs.
> This must be compatible with IE6 (and higher) and latest
> release of FF.
IE 6 has no support for data URLs, so it looks like you will need to
use server-side code.
Richard.
|
|
0
|
|
|
|
Reply
|
Richard
|
11/26/2009 1:47:58 PM
|
|
On Nov 26, 2:47=A0pm, Richard Cornford <Rich...@litotes.demon.co.uk>
wrote:
>
> IE 6 has no support for data URLs, so it looks like you will need to
> use server-side code.
<meta http-equiv=3D"X-UA-Compatible" content=3D"chrome=3D1">
http://code.google.com/chrome/chromeframe/faq.html
--
Jorge
|
|
0
|
|
|
|
Reply
|
Jorge
|
11/26/2009 10:25:49 PM
|
|
On Nov 26, 7:47=A0am, Richard Cornford <Rich...@litotes.demon.co.uk>
wrote:
> IE 6 has no support for data URLs, so it looks like you will need to
> use server-side code.
In IE6 you can use document.execCommand("SaveAs", null, "FileName");
Here an example for saving files in IE 6:
http://4umi.com/web/javascript/filewrite.php?txt=3DThis+is+some+sample+text=
..%0D%0AThis+is+a+new+line.&filename=3DC%3A%5CMy+Documents%5Cfilename&ext=3D=
utf-8#
For the OP, here's an example of prompting a download with a data uri:
http://thenewobjective.com/temp/save.html
For a plain text file, the uri will look something like this:
"data:text/octet-stream," + FileContents
|
|
0
|
|
|
|
Reply
|
Michael
|
11/26/2009 10:54:22 PM
|
|
Michael Haufe ("TNO") wrote:
> On Nov 26, 7:47 am, Richard Cornford <Rich...@litotes.demon.co.uk>
> wrote:
>
>> IE 6 has no support for data URLs, so it looks like you will need to
>> use server-side code.
>
> In IE6 you can use document.execCommand("SaveAs", null, "FileName");
>
[snip]
Good one!
Next step is to take both and create a cross-browser function and test
it in as many browsers.
Questions about your code:
1) why use - document.body.insertBefore( w ); - instead of appendChild?
3) why use window.open?
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
|
|
0
|
|
|
|
Reply
|
Garrett
|
11/26/2009 11:36:26 PM
|
|
Michael Haufe ("TNO") wrote:
> On Nov 26, 7:47 am, Richard Cornford <Rich...@litotes.demon.co.uk>
> wrote:
>
>> IE 6 has no support for data URLs, so it looks like you will need to
>> use server-side code.
>
> In IE6 you can use document.execCommand("SaveAs", null, "FileName");
>
> Here an example for saving files in IE 6:
>
> http://4umi.com/web/javascript/filewrite.php?txt=This+is+some+sample+text.%0D%0AThis+is+a+new+line.&filename=C%3A%5CMy+Documents%5Cfilename&ext=utf-8#
[snip]
The MSDN links in your article are broken. The correct links should be:
http://msdn.microsoft.com/en-us/library/ms536419%28VS.85,loband%29.aspx
http://msdn.microsoft.com/en-us/library/ms537418%28VS.85%29.aspx
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
|
|
0
|
|
|
|
Reply
|
Garrett
|
11/26/2009 11:41:52 PM
|
|
Michael Haufe ("TNO") wrote:
> Richard Cornford wrote:
>> IE 6 has no support for data URLs, so it looks like you will need to
>> use server-side code.
>
> In IE6 you can use document.execCommand("SaveAs", null, "FileName");
>
> Here an example for saving files in IE 6:
>
> http://4umi.com/web/javascript/filewrite.php?txt=This+is+some+sample+text.
%0D%0AThis+is+a+new+line.&filename=C%3A%5CMy+Documents%5Cfilename&ext=utf-8#
Joe User is not going to be able to type or to copy-paste the target file
path, though.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
|
|
0
|
|
|
|
Reply
|
Thomas
|
11/27/2009 12:02:20 AM
|
|
On Nov 26, 5:36=A0pm, Garrett Smith <dhtmlkitc...@gmail.com> wrote:
> Good one!
>
> Next step is to take both and create a cross-browser function and test
> it in as many browsers.
>
> Questions about your code:
> 1) why =A0use - document.body.insertBefore( w ); - instead of appendChild=
?
> 3) why use window.open?
The 4umi.com website is not my domain, only the thenewobjective.com
domain is.
|
|
0
|
|
|
|
Reply
|
Michael
|
11/27/2009 12:49:19 AM
|
|
Garrett Smith wrote:
> Michael Haufe ("TNO") wrote:
>> On Nov 26, 7:47 am, Richard Cornford <Rich...@litotes.demon.co.uk>
>> wrote:
>>
>>> IE 6 has no support for data URLs, so it looks like you will need to
>>> use server-side code.
>>
>> In IE6 you can use document.execCommand("SaveAs", null, "FileName");
>>
>
> [snip]
>
> Good one!
>
> Next step is to take both and create a cross-browser function and test
> it in as many browsers.
>
> Questions about your code:
> 1) why use - document.body.insertBefore( w ); - instead of appendChild?
Perhaps, to avoid IE's "Operation aborted" error?
<http://support.microsoft.com/kb/927917>
--
kangax
|
|
0
|
|
|
|
Reply
|
kangax
|
11/29/2009 1:25:43 AM
|
|
|
8 Replies
361 Views
(page loaded in 0.204 seconds)
Similiar Articles: Read data from embedded XML file within a PDF ? - comp.text.pdf ...a) Use the Excel file (as CSV) to feed a web page, and use Javascript or PHP to do the checking and ... success. > >> So is there a way to embed a xml or csv file, and make ... ODS output CSV file with a title: - comp.soft-sys.sasJAVASCRIPT AND EXCEL, SET OUTPUT FILE NAME - comp.lang.javascript ... ODS output CSV file with a ... Using ODS HTML to create the .XLS or .CSV files will place the entire ... How to dynamically create filenames w/date/time stamps. - comp ...... datehr = vDay & "-" & vMonth & "-"& vHour & ".csv ... Dynamically generate textboxes using javascript - comp.lang ... ... and time/date stamp - comp.cad.solidworks ... create file ... remove any commas/data from mysql? - comp.databases.mysql ...I know how to remove them using JavaScript at the point when they are entered ... >> >> In the php to create the csv file I have >> >> $result = mysql_query($sql,$conn ... Start file download using onclick... - comp.lang.javascript ...Hi all, I'm creating an application for our needs and I want to make something using JavaScript, but I don't know how. Hope somebody will be able to ... Converting Btrieve DTA file to csv or txt - comp.databases.btrieve ...... the structure and build the DDF files. You can download at www.nssdd.com. It can also export to CSV format ... CSV Files | eHow.com A CSV file (comma separated values) is a ... Trying to Create a Dialog Box for Multiple div's - comp.lang ...using javascript with radio button to disable a text box - does ... Hi, I am trying to ... Importing data from CSV file - comp.databases.filemaker If you check that box then ... GNU Make: replace spaces with commas - comp.unix.programmer ...RegExp problem: - comp.lang.javascript Do you want to replace multiple space or ... Quote (and !Unquote) within the macro, might make ... CSV files with some double-quoted ... reading xls without proc import or changing file type - comp.soft ...It _can_ create an HTML, CSV or XML file, all of which can be opened by MS Excel Software. ... of that approach in my ODS-related papers available for free download at ... Pervasive 7: export data to sql-script - comp.databases.btrieve .../EC[file] Logs to SQLEXEC.ERR [or file] as Comma-Separated Values. /D Enables Debugging Output. ... Pervasive Data Provider for .Net Available for Download ... Create CSV file from HTML Table using javascript - CodingForums.comI have already found a way of converting my HTML table to a downloadable Excel spreadsheet file. By 'downloadable' I don't mean it was then saved on the server and ... create a dowloadable csv file in a javascript - HighDots ForumsHello, I make calculations and many thinks in a page that result in a javascript table file. I know how to create a CSV string from this table in JS, 7/25/2012 5:06:58 AM
|