File upload in the Facebook In App Browser

On some Android phones, both the Facebook and Instagram In App browsers (as of today) behave incorrectly if an upload field within an advertised or linked landing page had the accept attribute specified. As a result, the button had no function. If you open the page in the external, normal browser outside of the Facebook app, everything is fine. This is annoying (especially since it has been reported for a long time), but can be solved with a workaround.

The following JavaScript fix solves the problem and makes the buttons work again: