3135 posts
  • Beta Tester
  • Bought between 500 and 999 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 1 000 and 5 000 dollars
  • United States
  • Won a Competition
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!

230 posts
  • Has been a member for 4-5 years
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
  • United Kingdom
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
  • Beta Tester
  • Bought between 500 and 999 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 1 000 and 5 000 dollars
  • United States
  • Won a Competition
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