'How do I get what kind of device who visits my website? [duplicate]
I am making a JavaScript game but I want the canvas to be different sizes depending if it is for instance an iPhone who visits
const canvas = document.querySelector("canvas"); canvas.width = 500;
So my question is how do I get the device information?
Solution 1:[1]
You can simply use the width and height property of the window.screen object
const width = screen.width;
const height = screen.height;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | af5l |
