Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipad orientation detection in php?

Tags:

php

ipad

Hi I want to detect ipad orientation in php, i know i can detect the iPad but how do i detect the orientation, i need it in php and not css because i want to show x pictures in my gallery in portrait and x in landscape.

here is the code i am using to detect the php for iPad:

if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') !== FALSE) {

} else {

}

i have checked on this site and on google but was unable to find anything which could help

thankyou

like image 406
graham Avatar asked Feb 22 '26 10:02

graham


1 Answers

iPad orientation can change when the user holds her iPad differently. Therefore, there's no point of registering it in php - by the time your response reaches the client, it might already be different.

If there needs to be any plumbing that can't be done in CSS (like loading different images or so), handle the orientationchanged event in JavaScript.

like image 178
phihag Avatar answered Feb 25 '26 00:02

phihag