1

when I visit https://m.facebook.com/ I can upload a picture from gallery , or take picture from camera.

How it is possible that a website is able to run native actions ?

zizoujab
  • 7,603
  • 8
  • 41
  • 72
  • 2
    http://stackoverflow.com/questions/6336641/html5-camera-access-through-browser-in-ios basically, the iOS developers allow certain form types to perform certain actions. Same for other developers. Just search. – Prisoner Sep 05 '14 at 16:44
  • This is a solution for iOS only, but for facebook it works on android too – zizoujab Sep 05 '14 at 16:46
  • Apache Cordova can access your device using javascript. I'm just not sure if you can use it on a website – patricK Sep 05 '14 at 16:50
  • 1
    Like I said, it works the same with other devices. See http://www.html5rocks.com/en/tutorials/getusermedia/intro/ – Prisoner Sep 05 '14 at 16:51
  • 2
    Hey folks, this question is not a duplicate of the iOS question. The answers may be the same, but the questions are different. – Brad Sep 05 '14 at 16:55
  • as @brad Said it's not the same question I havent specified any platform here , m.facebook.com works on android, ios , wp ... – zizoujab Sep 05 '14 at 17:04

2 Answers2

3

Have you tryed something like this?

<input type="file" accept="image/*;capture=camera">

http://www.w3.org/TR/2010/WD-media-capture-api-20100928/

patricK
  • 1,045
  • 11
  • 27
3

You can use the

<input type="file" accept="image/*;capture=camera">
<input type="file" accept="video/*;capture=camcorder">
<input type="file" accept="audio/*;capture=microphone">

Compatability:

  • Android 3.0 browser - one of the first implementations. Check out this video to see it in action.
  • Chrome for Android (0.16)
  • Firefox Mobile 10.0
  • iOS6 Safari and Chrome (partial support)

source

Prisoner
  • 27,391
  • 11
  • 73
  • 102
  • This is the best method, as if the device doesn't support capture, it still functions as a file upload. – Brad Sep 05 '14 at 16:54