/note: this only applies when used on the specified domain, but works practically/
I've been trying to simulate a mouse click event, it works for anything else but not for this..
I tested it, it is working now somehow.. but whenever I try to run on this website: http://www.multiplayerpiano.com/ it seems not to work...
<input type="file" id="_LOAD" accept="mp3" />
$('#_LOAD').click();
this doesn't work..
I've also tried
$('#_LOAD')[0].click();
no luck..
can anyone please explain what is it that is blocking it on That specific domain?
// edit - original code
I was trying to make a function which will allow me to make file dialog box's which only allows a specific mime type to be allowed
var load = function(mime,callback){
var tempmime = (mime) ? mime : "";
var tempinp = $('<input style="position:absolute;opacity:0;z-index:-1;pointer-events:none" type="file" id="_LOAD" ' + (tempmime == "" ? "" : 'accept=".' + tempmime + '"') + '/>')
$("body").append(tempinp);
$(tempinp).focus().click();
//
var aab = function(msg){
callback(msg);
$(tempinp).off('change',aab);
$(tempinp).remove();
};
$(tempinp).on('change',aab);
}
So this is as far i have got without .click working.