globalVeriable.js 758 B

123456789101112131415161718192021
  1. let sUserAgent = navigator.userAgent.toLowerCase();
  2. window.isTouchDevice = [
  3. "android", "ucweb",
  4. "iphone os", "ipad", "ipod",
  5. "windows phone os", "windows ce", "windows mobile",
  6. "midp", "symbianos", "blackberry", "hpwos", "rv:1.2.3.4",
  7. ].some(s => sUserAgent.includes(s));
  8. // for iPadOS
  9. if (!isTouchDevice && sUserAgent.includes("safari") && sUserAgent.includes("version")) {
  10. if (!sUserAgent.includes("iphone") && "ontouchend" in document)
  11. window.isTouchDevice = true;
  12. }
  13. import { isWebGL2Context } from "./utils/isWebGL2Context.js";
  14. window.isSupportWebGL2 = (() => {
  15. let ctx = null;
  16. try { ctx = document.createElement("canvas").getContext("webgl2"); }
  17. catch(e) { ctx = null; }
  18. return isWebGL2Context(ctx);
  19. })();