Welcome, Guest
Username Password: Remember me

php if statement when file accessed via mobile?
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: php if statement when file accessed via mobile?

php if statement when file accessed via mobile? 12 years, 7 months ago #5546

  • marklandry
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Hi, I'm working on a site that's been hacked to death.
Normally I would use itemid from a mobile menu to make mobile-conditional elements on a page, but that's not working.

Is there a php if statement I can use that senses access via a mobile device?
Something like
 
<?php if (mobile device):?>
do this thing
<?else:?>
do this other thing
<?php endif;?>


I'm guessing there's probably not anything universal since there are so many browsers, but I thought I'd check...

Re: php if statement when file accessed via mobile? 12 years, 7 months ago #5547

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4866
  • Karma: 105
if (defined('_MJ')) { /* mobile */ } else { /* desktop */ }
  • Page:
  • 1
Time to create page: 0.12 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.