Learning notes
Viewport
screen.width
and screen.height
return the width and height of the screen in pixels, including the taskbar and other UI elements. Zoom will change how each pixel is rendered and the screen width and height will change accordingly. If zoom is set to 100%, screen.width
and screen.height
will return the actual pixel dimensions of the screen. Otherwise, they will return the dimensions of the screen in CSS pixels, which may be different from the actual pixel dimensions due to zooming.
User Agent
The User Agent (UA) string is a string that a web browser sends to a web server to identify itself and provide information about the browser and operating system. The UA string can be used to determine the capabilities of the browser, such as whether it supports certain features or how it should render a page.
- navigator.userAgent
returns the User Agent string of the browser.
Web Worker
Web Workers allow you to run scripts in background threads, separate from the main execution thread of a web page. This enables you to perform tasks without blocking the user interface, improving performance and responsiveness.