Js download a clientside app






















Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Client side file creation and download Ask Question.

Asked 10 years, 9 months ago. Active 5 years, 4 months ago. Viewed 12k times. Do you want to create a file using Client side Javascript? AFAIK there is no way with only js. It seems nobody here has provided an automatic client side cross-browser solution so here it is: stackoverflow. Possible duplicate of Create a file in memory for user to download, not through server — Marc L. Add a comment. Active Oldest Votes. Size; alert "The size of the test.

Pranay Rana Pranay Rana k 34 34 gold badges silver badges bronze badges. Davide - I just show the way to increase his knowledge that we can do it in ie browser , and my answer some how meet with his half requirement..

I see your point but wanted to note we should not target any specific browser or operating system, code above would probably fail on ipad or any other non windows platform. Matt Sanders Matt Sanders 6, 1 1 gold badge 28 28 silver badges 39 39 bronze badges. Here is the solution: I am in the project build on SmartClient. What I did is made two JSPs namely: blank. Now when ever user asks to export the grid data, I do below: Open a new window with url blank.

Now POST that form to export. Contents of export. This is entirely serverside and so has nothing to do with the question — B T. Community Bot 1 1 1 silver badge. LOL — arinte. So it's natural that most of the file-saving code out there relies on a flash movie to do the actual working of generating the file and popping up a 'save' dialog box to show the user.

This uses a flash movie to allow users to copy and download the contents of a table in various formats. The flash movie's capabilities are configured via Javascript. An open source tool called Downloadify enables anyone to integrate such a Flash Javascript combo file downloader into their website.

From looking at this and the TableTools solution it seems that in order for the Flash movie to trigger a file saving dialog the user must click within the flash movie.

It doesn't seem possible trigger it directly through Javascript. Thus you will need to render the Flash movie button on your page for the user to click.

Neither of the previous options were really appearing. I set out searching for cross-browser ways of achieving what I wanted and came across the data URI scheme. This involves encoding the file contents as, say, the href attribute of an anchor tag as follows:.

Support for this method is patchy across browsers and versions of IE older than 9 have a 32 KB limit in terms of the size of the resulting file. But the biggest downside is that you cannot set what the name of the file ought to be see RFC This is a work in progress by the W3C to specify a standard way of writing and saving files from Javascript though at the moment it isn't yet supported by any browsers.

Chrome is aiming to support it soon already? I looked up TiddlyWiki and it is said to use a Java applet to save files when there are no proprietary file system APIs available. And that thing has been around for years so it would know what works best. I've decided to go with Downloadify - the Flash Javascript solution - for now whilst I'm developing the application. It works quite well and is easy to use.



0コメント

  • 1000 / 1000