Detect whether user's browser can support HTML 5 uploading (with progress bar?)
Thinking of using this site http://www.matlus.com/html5-file-upload-with-progres开发者_StackOverflow社区s/ to help me incorporate HTML 5 uploading into the new website that I'm developing - but obviously all browsers don't support this.
How would I go about detecting whether the user's browser can support HTML 5 uploading with the progress bar. If it can then I'd like the user to upload through HTML 5 - if they can't then I'd like to show a SWF uploader for them - and if they don't have flash I guess I'll just have to show the original HTTP uploader with status bar progress.
If possible, I'd like to detect it without using javascript - so users can still upload files if they've got javascript disabled.
Thanks
This may be a comment more than an answer and you may already have found your answer in the last 29 days. There is an article, http://dojotoolkit.org/documentation/tutorials/1.6/uploader/, that is specifically to implement the upload in HTML5. I think the bare input field (plus server script) will handle the post when javascript is off. With javascript on, it describes Ajax options (to accommodate IE). So it falls back to your choice of iframe/flash in absence of HTML5. It's doing the detection (javascript) for you. If you are going to perform the detection yourself, it's still javascript (http://www.rominirani.com/html5-recipes-using-modernizr/).
精彩评论