Getting the screen resolution using PHP

前端 未结 21 2403
你的背包
你的背包 2020-11-22 06:50

I need to find the screen resolution of a users screen who visits my website?

21条回答
  •  爱一瞬间的悲伤
    2020-11-22 07:05

    JS:

    $.ajax({
        url: "ajax.php",
        type: "POST",
        data: "width=" + $("body").width(),
        success: function(msg) {
    
            return true;
        }
    });
    

    ajax.php

    if(!empty($_POST['width']))
        $width = (int)$_POST['width'];
    

提交回复
热议问题