【Browser】Properties and methods of Screen object

Attributes

1.availHeight

Definition: Declares the available height, in pixels, of the screen on which the browser is displayed. On operating systems like Windows, this available height does not include the vertical space allocated to semi-permanent features such as the taskbar at the bottom of the screen.
Syntax: screen.availHeight
Example:

console.log("长:"+screen.availHeight,"宽:"+screen.availWidth)//输出结果:长:896 宽:414

2.availWidth

Definition: Declares the available width, in pixels, of the screen on which the browser is displayed. On operating systems like Windows, this available width does not include the vertical space allocated to semi-permanent features such as the taskbar at the bottom of the screen.
Syntax: screen.availWidth
Example:

console.log("长:"+screen.availHeight,"宽:"+screen.availWidth)//输出结果:长:896 宽:414

3.colorDepth

Definition: Returns the bit depth of the palette on the target device or buffer.
Syntax: screen.colorDepth
Example:

console.log(screen.colorDepth)//我电脑输出结果:24

4.height

Definition: Declares the height of the screen displaying the browser, in pixels.
Syntax: screen.height
Example:

console.log(screen.height);//输出结果:896

5.pixelDepth

Definition: Returns the color resolution (bits per pixel) of the display screen
Syntax: screen.pixelDepth
Example:

console.log(screen.pixelDepth)//输出结果:24

6.width

Definition: Declares the width, in pixels, of the screen on which the browser is displayed.
Syntax: screen.width
Example:

console.log(screen.width);//輸出結果:1920

Guess you like

Origin blog.csdn.net/m0_46533551/article/details/129560585