Download file in Safari with JavaScript - javascript

Is there a way to download a file with the filename in Safari using JavaScript/jQuery?
I've created an anchor element with a url that looks like this:
Download File
Unfortunately, the download attribute hasn't been implemented in Safari yet (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a). So when the file downloads in Safari (my version is 8), the file name is "unknown".
Is there a workaround so that when the file downloads in Safari (8+), it will have the filename?
I downloaded a file from dropbox in Safari and it worked fine, filename and all. How'd they do that??

I found a solution in case anyone runs across this problem. jQuery fileDownload works fine in Safari event though the developer doesn't officially list it as a supported and tested browser. https://github.com/johnculviner/jquery.fileDownload

Related

Why is webkitRelativePath always empty in Safari browser?

I need to support folder upload in my website similar to Google Drive.
I'm using webkitdirectory for this. Using webkitdirectory sets webkitRelativePath for all sub-files of the selected folder. But this only works for Firefox and Chrome.
Is there are any way to achieve the same result in Safari Browser?
That could be helpful too, thanks.

Firefox won't play sounds, but works in other browsers

I try to play sounds with "Howler.js", but it's not working in FF in every other browser it works.
To test if it is a problem with the sound files I opened the directory containing the files with the browser.
I have a '.mp3' file, a '.ogg' file, a '.wav' and a '.webm' file.
In FF none of them are working, FF only gives me the message "Video could not be played, because the file is broken.".
Now I'm totally confused, because other browsers don't complain about the audio files.
I appreciate any help.
Found a solution myself. The problem was that I started the Code via node and gulp, which resulted in wrong mime types, which was a problem for Firefox. When the application is started via apache, the mime types are correct and everythings working fine.

SoundJS: Firefox is not able to play a mp3

I am currently working on a website that includes a musicplayer made with SoundJS.
I, myself, am using Google Chrome to test and debug my website, and it worked like a charm, but when I recently tested it in FireFox, I noticed this strange error.
When I hit the play button and the sound is being registered I get this error:
The buffer passed to decodeAudioData contains an unknown content type
The code I use in my javascript file to create the soundInstance:
'response' is a string containing the location of the .mp3 file (this all works perfectly in Chrome).
createjs.Sound.registerSound('uploads/songs/'+response,'song');
When I test this same piece of code with an 'ogg' file it works perfectly in FireFox.
I also heard from some people that it doesn't work in Safari too, but unfortunatly I am a windows user.
If you want to test it for yourself:
www.playmesome.be . Just hit the play button and it will keep on loading infinitely because of this error.
Thanks for reading!
there is a known issue with Firefox on windows that does not load all mp3 files properly, and therefore it is recommended that you load another supported file type first (such as ogg).
Hope that helps.

Audio.js and .ogg on Firefox for Mac

Got a bit of a weird issue. I am using Audio.js to play some audio files.
Across all platforms and all browsers everything works perfectly apart from Firefox for Mac. The files just do not want to play. They download OK and Audio.js outputs thats they have fully downloaded, but will not play. I have tried files uploaded to our cloud storage provider (they stream fine on all the other browsers), the same files served locally and a third party .ogg file found online.
Nothing.
Anyone had issues with .ogg files playing on Firefox for Mac? Would it be a files header issue? Anyone had issues with Audio.js having problems playing .ogg files in FF on a Mac?
From the docs, ogg vorbis files are not supported. Also, the implementation needs flash in Firefox to work it seems: kolber.github.io/audiojs
(Since your test-case works only in FF on Windows, and not FF on OSX):
FF on Windows can use OS-level MP3 implementation, whereas FF on OSX does not have access to the MP3 codec freely.. not sure if that's what's causing it, but it could be used for the feature detection in the library (as it is an OGG)

File Upload issue in ipad

I am using http://uniformjs.com/ for form elements its work fine in all browser as well as different devices, but only a thing which I noticed is about “File Upload” function is not work in iPad.
Anyone can guide how to fix this issue, without download any other supported app like picupapp.com
Thanks
In iOS (iPhone and iPad), file upload through browser just doesn't work.
You'll need to create an App for that. See some info about file upload Cocoa here: How can I upload a photo to a server with the iPhone?
Or, if you can afford to leave out all the pre iOS6 devices, it seems like they added support for <input type="file"> in their latest version.

Categories

Resources