csp_water
csp_water

Reputation: 31

Facebook built in browser w/ input file

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

Upvotes: 3

Views: 2175

Answers (2)

fmortara
fmortara

Reputation: 1

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.

Upvotes: 0

Diogo Gomes
Diogo Gomes

Reputation: 2265

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');
}

Upvotes: 2

Related Questions