How do I determine the screen resolution of users who have visited the site?

Asked 2 years ago, Updated 2 years ago, 58 views

How do I get the screen resolution for users who have visited the site?

I would be happy if I could get both browser resolution and screen resolution like you did.

Confirm
http://www.ugtop.com/spill.shtml

ruby-on-rails apache nginx

2022-09-30 14:34

1 Answers

As OOPer pointed out, don't you just look at the source without asking a question?

Get screen resolution

<span id="ossize"></span>
<script type="text/javascript">
    window_load();
    screen.width=window_load;
    function window_load(){
        varsW,sH,s;
        sW = screen.width;
        sH = screen.height;
        s=sW+"x"+sH+"pix";
        document.getElementById("ossize").innerHTML=s;
    }
</script>

Browser Resolution Retrieval

<span id="bsize"></span>
<script type="text/javascript">
    window_load();
    window.onresize=window_load;
    function window_load(){
        varsW,sH,s;
        sW = window.innerWidth;
        sH = window.innerHeight;
        s=sW+"x"+sH+"pix";
        document.getElementById("bsize").innerHTML=s;
    }
</script>

As you can see, you need to use JavaScript to retrieve it on your browser, so you need to create a process to send the resulting values to the web server.


2022-09-30 14:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.