3135 posts
    Has been part of the Envato Community for over 5 years Has sold $1,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 500+ items on Envato Market
+4 more
Daniel_R says

Hello creative nation! I hope you all are doing awesome.

I dont know if this is the right place to post but Im looking for a script to detect the user display monitor size.

I have a website for wallpapers and I want the website to be able to automatically detect the correct display monitor size and suggest it to the user so he/she an download the right wallpaper size.

Any suggestions ideas will be much appreciate it. THanks!

239 posts
    Has referred 1+ members Has sold $10,000+ on Envato Market Has collected 1+ items on Envato Market Has been part of the Envato Community for over 4 years
+2 more
phpdude says

Hi Daniel,

It’s pretty simple to detect browser size, and there are two options:

Option 1 – Handle it all via JavaScript Browser sizes can only be grabbed by JavaScript using window.screen.width and window.screen.height

Option 2 – Send the JavaScript variables to PHP If you need to use PHP to manipulate the site, then you can parse the JavaScript variables to PHP via an AJAX call so it would access the url like this:

script.php?width=window.screen.width&height=window.screen.height.

This is a good place and should get you started: http://stackoverflow.com/questions/1504459/getting-the-screen-resolution-using-php

3135 posts
    Has been part of the Envato Community for over 5 years Has sold $1,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 500+ items on Envato Market
+4 more
Daniel_R says

Hi Daniel,

It’s pretty simple to detect browser size, and there are two options:

Option 1 – Handle it all via JavaScript Browser sizes can only be grabbed by JavaScript using window.screen.width and window.screen.height

Option 2 – Send the JavaScript variables to PHP If you need to use PHP to manipulate the site, then you can parse the JavaScript variables to PHP via an AJAX call so it would access the url like this:

script.php?width=window.screen.width&height=window.screen.height.

This is a good place and should get you started: http://stackoverflow.com/questions/1504459/getting-the-screen-resolution-using-php

thank you so much for your help! This helps!

by
by
by
by
by
by