A tiny javascript + Flash library that enables the creation and download of text files without server interaction.

Related tags

Database Downloadify
Overview

Downloadify: Client Side File Creation

Important! The swf has been compiled for online use only. Testing from the file path (i.e. file:// ) will not work as it will violate the security sandbox.

Overview

This library is a tiny JavaScript + Flash library that allows you to generate files on the fly, in the browser, without server interaction. Web applications that allow you to generate vCards, color palettes, custom code, etc would benefit from using this library. In addition to increasing speed (no round trip to the server) this solution can reduce the database and server load of existing web applications. This is not a library to ‘force download’ a file from a server. It does not interact with a server at all.

Demo

A very simple demo is available that lets you supply your own content and filename and test out saving, canceling, and the error functionality when the file is blank.

For a real world usage, see Starter for jQuery . To quickly demo the usage, just click “Load Example Data” then click Download. After the initial page load, no further contact is made with the server. Everything happens on the client side.

Download

Please download from the Downloads section of this project.

Support

For support, please use the Issues section of this project. You can also try to hit me up on Twitter at @dougneiner but I might just ask you to file an issue. :)

Dependencies

The end user must have Flash 10 or higher installed for this plugin to work. As of September 2009, it was at a 93% saturation, so most users should already have it installed.

Downloadify is only dependent on SWFObject 2.0 which is included with the download. It is compatible with any JavaScript framework but has a helper for both jQuery and MooTools. Neither helper will be activatd if Downloadify is inserted prior to including the framework library.

Usage

Any JavaScript framework:

Downloadify.create( id_or_DOM_element, options );

jQuery:

$("#element").downloadify( options );

MooTools:

$("elementid").downloadify( options );

Options

Unless you are using the jQuery plugin included with Downloadify, you must supply all required options with your call to the Downloadify.create function.

Defaults and Required Options

  • swf: ‘media/downloadify.swf’ Required
    Path to the SWF File. Can be relative from the page, or an absolute path.
  • downloadImage: ‘images/download.png’ Required
    Path to the Button Image. Can be relative from the page or an absolute path.
  • width: 175 Required
    Width of the button (and the flash movie)
  • height: 55 Required
    Height of the button. This will be 1/4 the height of the image.
  • filename: Required
    Can be a String or a function callback. If a function, the return value of the function will be used as the filename.
  • data: Required
    Can be a normal String, base64 encoded String, or a function callback. If a function, the return value of the function will be used as the file data.
  • dataType: ‘string’
    Must be a String with the value string or base64. Data paired with the dataType of base64 will be decoded into a ByteArray prior to saving.
  • transparent: false
    Set this to true to use wmode=transparent on the flash movie.
  • append: false
    By default the contents of the targeted DOM element are removed. Set this to true to keep the contents and append the button.

Event Callbacks

No data is passed into these functions, they are simply called.

  • onError: Called when the Download button is clicked but your data callback returns "".
  • onCancel: Called when the Download button is clicked but the user then cancels without saving.
  • onComplete: Called when the Download button is clicked and the file is saved to the user’s computer.

Setting Up the Image

Downloadify supports (i.e. requires) three button states with limited support for a fourth. The states are:

  • Normal
  • Over ( When the mouse hovers over the button )
  • Down ( When the button is pressed )
  • Disabled ( Limited support, when .disable() is called on the Downloadify.Container object )

In trying to keep this plugin as simple as possible, all four states are always assumed to be present. You should prepare your button image as a single image the width you want your button, and four times the height of the button. All four states should then live in that one image in the same order as the previous list from top to bottom.

Potential Issues

When working with different button images, you may find Flash has cached your image. This is the desired behavior on a live site, but not during development. To get around this, simply supply a ?rev=1 or ?rev=2 etc on the end of your downloadImage url.

Compiling Notes

I develop locally using Xcode and the Flex 4 SDK Beta 2. Please do not submit request on how to setup a local testing environment. If you are interested in my Xcode project files, send me a message.

Developers

Core Developer: Doug Neiner

Contributors:

Change Log

  • Version 0.2:
    • Added support for base64 via the as3base64 Library
    • Added dataType option
    • Added MooTools helper (Thanks David!)
    • Upgraded SWFObject to v2.2
  • Original Release: Version 0.1

License Information: MIT

as3base64: Copyright © 2006 Steve Webster

All Downloadify Code: Copyright © 2009 Douglas C. Neiner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Allow Downloadify to run in offline mode

    Allow Downloadify to run in offline mode

    I need the swf file to work in offline mode as my application is not served from webserver, but instead distributed as html file. Is there any way to allow file:// access to Downloadify?

    opened by tmcchandra 7
  • File dialog hangs on Safari 9 on El Capitan

    File dialog hangs on Safari 9 on El Capitan

    Surprisingly, this not happen on Yosemite with Safari 9. When you try to download the file, the file dialog shows up. Clicking 'save' button makes the whole browser hang.

    Even the simplest demo (http://pixelgraphics.us/downloadify/test.html) hangs the entire Safari process (needs to be closed with Activity Monitor).

    I've checked with other Flash apps and it seems to be a general problem with Flash after upgrade to El Capitan. I will fill a bug with Apple, but I wanted to give some sort of heads up here.

    opened by anowak 5
  • Regular button or <a> link instead of Flash image?

    Regular button or link instead of Flash image?

    Hi folks!

    Is it somehow possible not to show Flash image with painted button but invoke Save As dialog by regular clicking on a form button or an "a onclick" link instead?

    Thank you! Martin

    opened by vrkuvrku 5
  • Downlodify is not working, no error message at all

    Downlodify is not working, no error message at all

    I have the latest shock wave (11.9.900.117) add-on installed to my Firefox (24).

    When i download and run the sample test.html file nothing is happening.But when i run the same demo linked (http://pixelgraphics.us/downloadify/test.html) HTML from Git hub works as expected.

    Also i have tried this with my project too, same kind of output, nothing happens but the button hides.There are no error messages shown or can be caught since i cant go through the swfobject.js file.

    I am using javascript alone, not jquery etc.

    Is there anything that i am missing some basic stuffs?

    Posted in http://stackoverflow.com/questions/19573697/downlodify-is-not-working-no-error-message-at-all too.

    Thanks in advance.

    opened by sankarge 4
  • Offline usage?

    Offline usage?

    I can't find a source file for downloadify.swf, is it possible to make one available, or post one compiled for offline use?

    I want to compile for offline use, since I'm making a web app that will work online client-side, and also have an identical downloadable version for offline use.

    opened by thewilmo 4
  • New line issue in textarea - Chrome and Firefox

    New line issue in textarea - Chrome and Firefox

    Hi

    I'm creating a keyword research tool and am using Downloadify as a export option allowing users to save the keyword list from a HTML textarea.

    The keywords need to be on new lines within the textarea. However when exporting this with keywords on multiple lines using Downloadify to save it as a txt file... all keywords are merged onto one line. It works fine with IE... but Chrome & Firefox share the same problem.

    Is there anything we can do to fix this?

    Thanks, Matt

    opened by MRedford 4
  • Data uri with flash fallback

    Data uri with flash fallback

    I'm writing this issue as an improvement suggestion.

    It would be great to use data URI when possible. Something like what is in this gist: https://gist.github.com/2202660

    When possible here means when the size of the file is in the boundaries of the data URI limitations and when data URI are supported in the browser. This way we could avoid the use of flash in some cases. This would bring benefits such as efficiency and network bandwith savings (I think that flash files can't be cached).

    What do you think?

    opened by miguelcobain 3
  • UTF-8 doesn't supported when export to excel file .xls

    UTF-8 doesn't supported when export to excel file .xls

    I used Downloadify to export content to excel file .xls, but it seems UTF-8 doesn't supported. Maybe it belongs to excel structure. But please help me if you have any ideas about this problem.

    TrungWebsite.com Thanks a lot.

    opened by trungwebsite 3
  • Binary data in a string makes the download button to fail

    Binary data in a string makes the download button to fail

    I'm using downloadify to save image data which is a binary string, this causes the download button to fail to popup the save dialog, this is tested against the online demo.

    I will attach some data that causes it to fail (just paste it into the Downloadify Example.

    opened by jontaylor 3
  • Trigger

    Trigger "save to disk" button call with external javascript

    Sorry, I know this is not an issue. But, I did not know how else to get in touch with you. I Just wanted to know if there is any way to trigger the "save to disk" button call with an external Javascript function?

    opened by az9214 3
  • Hangs in IE8

    Hangs in IE8

    When I add Downloadify with the following code window["Downloadify"]["create"](strId, { "filename": "responses.csv", "data": fnGetCsvResponses, onError: function%28) { alert('Error'); }, "transparent": false, "swf": 'http://obsurvey.com/js/external/downloadify.swf', "downloadImage": 'http://obsurvey.com/js/external/download.png', "width": 100, "height": 30, "transparent": false, "append": false }); It just hangs in IE8. IE8 appears to be loading, but the download image never appears, it's just a white blank space. The same code works fine in Firefox and Chrome... I've tried changing transparent and append, but that changes nothing. You can see it live here: http://obsurvey.com/Obsurvey.aspx?uid=d94feb5d-952d-4541-a43c-73371e095d53 When you click "Individual responses" The save file works in FF & Chrome, but not IE8. (looking at innerHTML IE has no params for the flash object) I updated swfobject.js to the latest version 2.2, now everything works in IE and Firefox. In Chrome the "Save to disk" graphics comes up, but when you click it nothing happens.

    opened by ghost 3
  • freeze in Safari on Windows7

    freeze in Safari on Windows7

    Downloadify is working fine in all main browsers under Windows 7, but in Safari (5.1.7) I find that it saves the file, gives the onComplete dialog but then hangs at the 'Your file has been saved' box (i.e. does not accept a click on the 'ok' button)

    opened by paulwarren 0
Owner
Doug Neiner
Doug Neiner
A tiny wrapper around pg that makes PostgreSQL a lot of fun to use. Written in TypeScript.

A tiny wrapper around pg that makes PostgreSQL a lot of fun to use. Written in TypeScript.

Mojolicious 8 Nov 29, 2022
Allows the DAO to manage Saber pools and for anyone to create new pools without permission

Saber Pools Program Allows the DAO to manage Saber pools and for anyone to create new pools without permission. Setup Instructions Running tests Insta

Saber 7 Sep 4, 2022
Active ARAM BOOST without RP.

aram-booster Active ARAM BOOST without RP. Usage Requisites Make sure curl is installed, only MSVC version is expected If not, you can extract curl.ex

Nomi 29 Dec 22, 2022
If you are a Slack browser user, this userscript will allow you to auto-redirect without Slack asking if you want to open on the desktop app.

Auto-redirect for browser Slack users If you are a Slack browser user, this userscript will allow you to auto-redirect without Slack asking if you wan

Felipe Santos (he/him) 6 Aug 23, 2022
Same as sqlite-tag but without the native sqlite3 module dependency

sqlite-tag-spawned Social Media Photo by Tomas Kirvėla on Unsplash The same sqlite-tag ease but without the native sqlite3 dependency, aiming to repla

Andrea Giammarchi 17 Nov 20, 2022
Firebase Extension to automatically push Firestore documents to Typesense for full-text search with typo tolerance, faceting, and more

Firestore / Firebase Typesense Search Extension ⚡ ?? A Firebase extension to sync data from your Firestore collection to Typesense, to be able to do f

Typesense 101 Dec 28, 2022
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.

TypeORM is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic, React Native, NativeScript, Expo, and Electron platforms and can be used

null 30.1k Jan 3, 2023
project overview tool, used to analyze the amount of code, the number of files, code statistics and so on.

pot z-pot is a project overview tool, used to analyze the amount of code, the number of files, code statistics and so on. 项目概述工具,用于分析代码量、文件数、代码统计等。 快速

zhangchi 18 Aug 10, 2022
Parse and disassemble .metallib files in browser

MetalLibraryExplorer Parse and disassemble .metallib files in browser. https://yuao.github.io/MetalLibraryExplorer This is a WebAssembly port of Metal

Yu Ao 5 Dec 1, 2022
plain text editor

writer Plain text editor from scratch, made for the web. Drag and drop files to open them. Architecture Buffer is an array of array of lines Text is m

Paco 332 Jan 4, 2023
An adapter-based ORM for Node.js with support for mysql, mongo, postgres, mssql (SQL Server), and more

Waterline is a next-generation storage and retrieval engine, and the default ORM used in the Sails framework. It provides a uniform API for accessing

Balderdash 5.4k Jan 4, 2023
Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

Database manager for MySQL, PostgreSQL, SQL Server, MongoDB, SQLite and others. Runs under Windows, Linux, Mac or as web application

DbGate 2k Dec 30, 2022
A back-end server aplication created using node.js, express and mongodb.

Course Material and FAQ for my Complete Node.js, Express and MongoDB Bootcamp This repo contains starter files and the finished project files for all

Pablo César Jiménez villeda 1 Jan 4, 2022
A progressive Node.js framework for building efficient and scalable server-side applications

A light template to easily setup your backend with a simple jwt authentication with Nest.js and TypeScripit. Powered with Prisma and Hot-reload features

Junior Medehou 3 Feb 25, 2022
A progressive Node.js framework for building efficient and scalable server-side applications

A progressive Node.js framework for building efficient and scalable server-side applications. Description Nest framework TypeScript starter repository

Gustavo Lopes 3 Oct 31, 2022
A remote nodejs Cached sqlite Database Server, for you to have your perfect MAP Cache Saved and useable remotely.

A remote nodejs Cached sqlite Database Server, for you to have your perfect MAP Cache Saved and useable remotely. Easy Server and Client Creations, fast, stores the Cache before stopping and restores it again! it uses ENMAP

Tomato6966 6 Dec 18, 2022
DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB database, such as: connecting to the database, executing scripts, calling functions, uploading variables, etc.

DolphinDB JavaScript API English | 中文 Overview DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB

DolphinDB 6 Dec 12, 2022
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server & SQLite

Prisma Quickstart • Website • Docs • Examples • Blog • Slack • Twitter • Prisma 1 What is Prisma? Prisma is a next-generation ORM that consists of the

Prisma 28k Jan 2, 2023