Several web issues to be aware of when programming Android

  • 2020-06-12 10:39:21
  • OfStack

1 a:
webview is not supported on Android 4.4 or above [type=file], so be careful when uploading images. Make this clear to your customers.

The second:
new CustomEvent() doesn't seem to be supported below 4.4 on Android because it's frustrating for me too.

Third:
It is still uploading problem, do not write simplified code directly, 4.4 above is recognized, but 4.4 below will have problems.
Error:


createObjectURLfun = (window.URL || window.webkitURL || {}).createObjectURL || function() {};

Right:


createObjectURLfun = function(file) {
  if (window.navigator.userAgent.indexOf("Chrome") >= 1 || window.navigator.userAgent.indexOf("Safari") >= 1) {
    return window.webkitURL.createObjectURL(file);
  } else {
    return window.URL.createObjectURL(file);
  }
};

I hope you can avoid some pits. If you encounter some pits, please inform me so that I can also avoid some pits.


Related articles: