xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

window.navigator All In One

window.navigator All In One

"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2020-11-11
 * @modified
 *
 * @description
 * @difficulty Easy Medium Hard
 * @complexity O(n)
 * @augments
 * @example
 * @link
 * @solutions
 *
 * @best_solutions
 *
 */

const log = console.log;

if(window.navigator) {
  log(`window.navigator =`, navigator)
}

for(const item in navigator) {
  // log(`navigator.${item} =`, item);
  // log(`navigator.${item} =`, item, typeof item);
  log(`navigator.${item} =`, item, navigator[item]);
}

// navigator.vendorSub = vendorSub
// navigator.productSub = productSub
// navigator.vendor = vendor
// navigator.maxTouchPoints = maxTouchPoints
// navigator.userActivation = userActivation
// navigator.doNotTrack = doNotTrack
// navigator.geolocation = geolocation
// navigator.connection = connection
// navigator.plugins = plugins
// navigator.mimeTypes = mimeTypes
// navigator.webkitTemporaryStorage = webkitTemporaryStorage
// navigator.webkitPersistentStorage = webkitPersistentStorage
// navigator.hardwareConcurrency = hardwareConcurrency
// navigator.cookieEnabled = cookieEnabled
// navigator.appCodeName = appCodeName
// navigator.appName = appName
// navigator.appVersion = appVersion
// navigator.platform = platform
// navigator.product = product
// navigator.userAgent = userAgent
// navigator.language = language
// navigator.languages = languages
// navigator.onLine = onLine
// navigator.getBattery = getBattery
// navigator.getGamepads = getGamepads
// navigator.javaEnabled = javaEnabled
// navigator.sendBeacon = sendBeacon
// navigator.vibrate = vibrate
// navigator.scheduling = scheduling
// navigator.xr = xr
// navigator.mediaCapabilities = mediaCapabilities
// navigator.permissions = permissions
// navigator.locks = locks
// navigator.wakeLock = wakeLock
// navigator.usb = usb
// navigator.mediaSession = mediaSession
// navigator.clipboard = clipboard
// navigator.credentials = credentials
// navigator.keyboard = keyboard
// navigator.mediaDevices = mediaDevices
// navigator.storage = storage
// navigator.serviceWorker = serviceWorker
// navigator.deviceMemory = deviceMemory
// navigator.presentation = presentation
// navigator.bluetooth = bluetooth
// navigator.registerProtocolHandler = registerProtocolHandler
// navigator.unregisterProtocolHandler = unregisterProtocolHandler
// navigator.getInstalledRelatedApps = getInstalledRelatedApps
// navigator.clearAppBadge = clearAppBadge
// navigator.setAppBadge = setAppBadge
// navigator.getUserMedia = getUserMedia
// navigator.requestMIDIAccess = requestMIDIAccess
// navigator.requestMediaKeySystemAccess = requestMediaKeySystemAccess
// navigator.webkitGetUserMedia = webkitGetUserMedia


导航器界面表示用户代理的状态和身份。它允许脚本查询并注册自己以进行一些活动。

https://developer.mozilla.org/en-US/docs/Web/API/Navigator

多点触控检测

navigator.maxTouchPoints

const log = console.log;

const touchPoints = navigator.maxTouchPoints;

if (touchPoints > 1) {
  log(`✅ your browser supports multi-touch`)
} else {
 log(`❌  your  browser not supports multi-touch`)
}

https://www.w3.org/TR/pointerevents2/#extensions-to-the-navigator-interface

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/maxTouchPoints

refs

UA

https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent





©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-11-12 22:37  xgqfrms  阅读(253)  评论(7编辑  收藏  举报