php - Determine if operating system is Mac -
i have been doing lot of googling try , find simple, easy php script identify if user on mac or not.
i want use tell users if keyboard shortcut telling them "control" or "command". don't need know browser or anything, if computer mac.
here outline of i'm asking possible:
if (operating_system == mac) { echo "command"; } else { echo "control"; }
create page: identifier.php
<?php $user_agent = getenv("http_user_agent"); if(strpos($user_agent, "win") !== false) $os = "windows"; elseif(strpos($user_agent, "mac") !== false) $os = "mac"; ?>
then include on header of site.
after can use this:
<?php if($os === "windows") { } elseif($os === "mac") { } ?>
edit:
for windows phone:
if (strpos(strtolower($_server['http_user_agent']), 'windows phone os') > 0) { $mobile_browser = 1; }
Comments
Post a Comment