/    Sign up×
Community /Pin to ProfileBookmark

backgruond based on screen res without javascript

Can i detect screen resolution with PHP, then have an ELSEIF statement with popular screen resolutions with a better suited background for each resolution?

All the solutions i have found use javascript, my question is can it be done with PHP alone?

if so how?

Many thanks.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@felgallMar 20.2008 — Why do you care what the screen resolution is? You only get to fill the inside of the browser window with your content so if the browser window is 750x500 in area it doesn't matter that the screen resolution is 1600x1200.

The PHP runs before the page is sent to the browser and so the size of that browser window is not known to the PHP. You'd need to browser to send back the information to the server in order for PHP to know the resolution and you'd need JavaScript to do that.
×

Success!

Help @danpoulton spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...