I need to allow the user to save content generated by Clojurescript to their 
local drive.

I do it using this code -

(defn- save-file
  [filename content]
  (let [lnk (get-element-by-id "file-export-link")
        blob (js/Blob. (js/Array. content) {:type "text/plain"})]
    (set! (.-href lnk) (.createObjectURL js/URL blob))
    (set! (.-download lnk) filename)
    (.click lnk)))

When the function runs it does a pseudo download to the named file. This works 
with ":optimizations :none".

When I try the same thing with ":optimizations :advanced", instead of doing a 
download and prompting to open or save a file, it moves the browser to a URL 
like: "blob:null/d9bbcdab-7c87-....etc"

I have tried Chas Emericks's url package https://github.com/cemerick/url to 
create the URL but it still doesn't work.

Something is being munged by the optimization, but I am not sure what.
Does anyone have any ideas how to go about fixing this?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to