What to use instead of FileReader for Safari?

后端 未结 2 446
长发绾君心
长发绾君心 2020-12-03 18:09

(Am new to web programming, so apologies for any lack of rudimentary knowledge.)

My page allows a user to select a file that is then read clientside & displayed

相关标签:
2条回答
  • 2020-12-03 18:42

    Sadly, the only answer I can come up with will hog some extra bandwidth.

    Firstly, use something like if (typeof FileReader !== "undefined" or Modernizr to follow your normal flow for the browsers that DO support FileReader. Otherwise, POST the file via AJAX to some server-side script that echoes back the contents.

    So for compliant browsers, you get to save yourself some bandwidth and for non-compliant browsers you have to take one for the team.

    0 讨论(0)
  • 2020-12-03 18:45

    Another solution is to use "A FileReader polyfill for Internet Explore and Safari using Flash"

    See: https://github.com/Jahdrien/FileReader

    0 讨论(0)
提交回复
热议问题