Creating "downloadable" binary data on the client, for example, in JavaScript?

Disclaimer I have not done web programming for ages and am not even sure what and where to look.

Introduction

To all familiar with the concept of downloading files from websites, you click on the link on the web page, the server receives a request containing a URL, and responds with files appropriately packed with the specified type of content and all.

Problem

Now I need the same experience, except that the data is generated entirely on the client side without any requests returning to the server. I know that I can generate all the data on the client and even dynamically change the page being viewed using the DOM. But I'm not sure whether to embed this data on the page in a downloadable form, is it even possible and how to do it. Is it possible? In particular. HTML + JavaScript? If so, will it work in major browsers like IE, FF and Chrome? Will HTML5 be needed? Or am I doomed to serve data from a server or use other technologies (possibly Flash)?

+4
source share
1 answer

You can base64 encode the content in the href attribute of the a binding tag a . Cm:

http://webreflection.blogspot.com/2011/08/html5-how-to-create-downloads-on-fly.html

+1
source

Source: https://habr.com/ru/post/1395917/


All Articles