It is possible to convert to shapefile in JavaScript, in the client side. The following library accomplishes this. Perhaps it is outdated (2012-2013), but at least it shows the concept.
JS2Shapefile
JS2Shapefile is a Javascript class to create ESRI shapefiles directly in the browser. It also includes a couple of helper classes for creating and saving the binary data in browsers where that isn't fully supported (anything other than Chrome).
This library creates and saves the binary files in the browser using the HTML5 Filesystem API.
The HTML5 specs introduce the ability to work with binary data in Javascript. Binary data can be created using the ArrayBuffer TypedArray object. See http://www.khronos.org/registry/typedarray/specs/latest/ - this is currently implemented in browsers including Chrome and Firefox.
It uses different approaches for different browsers.
In summary: in Chrome we can create the data and save it to file entirely natively. On other browsers we need various levels of help. JS2Shapefile has been written to use these intermediate helper parts but if the client is guaranteed to be Chrome or something else implementing DataView, BlobBuilder, and Filesystem APIs, all that could be removed.
It has been featured in the ArcGIS website. The original repository was located at Google Code, but it is also available in GitHub. Here is another blog post about it.