3

currently we have a html page, contains misc fields + an

<input id="test_file" type="file" accept="image/*">

The android users when browsing via any browser can select a file (id=test_file), when we post the link on a facebook post and then click it, opens facebook internal browser, when click the button (id=test_file) nothing happens!

Any solution for this?

references

Community
  • 1
  • 1
csp_water
  • 31
  • 3
  • Flagged as duplicate but see this: http://stackoverflow.com/questions/24470932/html-file-upload-doesnt-show-gallery-on-android Basically Google removed this option from in-app browsers about a year ago with no explanation and is "thinking" of adding it back, no workaround available. You can detect via User Agent and tell the user to open in the standard Android browser as best possible fix imo – sricks Apr 17 '15 at 19:46

2 Answers2

2

Try to remove the accept attribute from the input file.

So my solution was to detect if its a native FB browser, and remove that attribute:

let isFacebookApp = function () {
    let ua = navigator.userAgent || navigator.vendor || window.opera;
    return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
};

if (isFacebookApp) {
   $('#myinput').removeAttr('accept');
}
Diogo Gomes
  • 2,135
  • 16
  • 13
0

I'm trying to solve this issue right now. Even i I remove the accept attribute, the upload field does not work: the field appear as not clickable.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 28 '22 at 12:47
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/31393517) – F.Mysir Mar 30 '22 at 13:05