Reputation: 53
This code works on Firefox, but does not work on Mac/iOS Safari. Is there a way to make it work?
$(function(){
setTimeout(function(){ $("input[name='upload']").trigger('click'); },1000);
});
Upvotes: 0
Views: 51
Reputation: 53
Apparently that's prohibited. probably in terms of security. https://mariusschulz.com/blog/programmatically-opening-a-file-dialog-with-javascript
Upvotes: 1
Reputation: 1814
not sure if this will work, but maybe you can try.
Add this meta tag at the top
<meta name="apple-mobile-web-app-capable" content="yes">
And for the input field maybe try
<input accept="image/png,image/gif,image/jpeg" type="file" name="upload" />
Hope this helps!
Upvotes: 1