This article describes how to obtain the screen parameters of the client using php, including the width, height, resolution, and other parameters, the js method is used to obtain the client computer screen parameters and then return them to the server using Ajax.
This article describes how to obtain the screen parameters of the client using php, including the width, height, resolution, and other parameters, the js method is used to obtain the client computer screen parameters and then return them to the server using Ajax.
This example describes how to obtain the screen parameters of a client using php. Share it with you for your reference. The specific analysis is as follows:
The first thing to note is that php is a server-side language and cannot obtain the width and height of the client screen. However, the work und is to use the client scripting language javascript to obtain the width and height of the client's computer screen, and then pass it to the php scripting language in the form of ajax or cookie, in this way, php can obtain the screen width and height of the client computer.
You can use javascript to obtain the width, height, and resolution of the client computer as follows:
Screen Resolution height: window. screen. height
Screen Resolution width: window. screen. width
Available screen workspace Height: window. screen. availHeight
Available workspace width: window. screen. availWidth
The method passed to the php server is as follows:
The Code is as follows:
$. Post ('HTTP: // localhost/php/index. php', {w: width, h: height}); // The returned value is ignored here.
The complete code for obtaining the width, height, and resolution of the display screen on the client computer using php is as follows:
The Code is as follows:
Untitled document