Monday, May 14, 2012

Download Attribute Overriding onClick <a>

I am using the download attribute to trigger a forced download of a song, but it seems to be overriding the onClick event. I can only do one or the other.

<input onclick="window.close()" type="button" value="Cancel"/>

var a = document.createElement("a"); = song + ".mp3"
a.href = url
a.onclick = function(e) {
var notification = webkitNotifications.createHTMLNotification(
document.getElementsByTagName("a")[0].innerHTML = "Download"

How do I both trigger the download, and fire the onClick event?

No comments:

Post a Comment