Note that there are some explanatory texts on larger screens.

plurals
  1. POCall a click on a newly added dom element
    primarykey
    data
    text
    <p>Im trying to call a click on this newly created anchor:</p> <pre><code>$('.file-status').html("Finished downloading &lt;a class='download' download href='#{fileEntry.toURL()}'&gt;#{name}&lt;/a&gt;") $('.download').click() </code></pre> <p>But the click event is not called. Not sure why this is?</p> <p>Im trying to force a download, not open the link in the browser. Like Dropbox does</p> <p><strong>EDIT</strong></p> <p>Here is the code, so its more clear:</p> <pre><code>fileEntry.createWriter ((fileWriter) -&gt; fileWriter.onwriteend = (e) -&gt; $('.file-status').html("Finished downloading &lt;a class='download' download href='#{fileEntry.toURL()}'&gt;#{name}&lt;/a&gt;") $('.download').trigger('click'); fileWriter.onerror = (e) -&gt; console.log "Write failed: " + e.toString() fileWriter.write blob ), errorHandler </code></pre> <p><strong>UPDATE:</strong></p> <p>So after understanding from the answers below that this is not really possible, except if the server sends the data to me with the header Content-disposition: attachment. But this seems to me like a realy bad solutions to pure HTML5 JS apps, that might be offline. </p> <p>So I found this, that handles this super awesomely! It works great. Here is the link:</p> <p><a href="http://updates.html5rocks.com/2011/08/Saving-generated-files-on-the-client-side" rel="nofollow">http://updates.html5rocks.com/2011/08/Saving-generated-files-on-the-client-side</a></p> <p>Hope this helps someone that wants to do the same as I am sure there are many! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload