I have been doing a lot of Googling recently to try and find a simple, easy php script that will identify if the user is on a Mac or not.
I want to use this to tell users if the keyboard shortcut I am telling them is "control" or "command". I don't need to know the browser or anything, just if the computer is a Mac.
Here is an outline of what I'm asking is possible:
if (operating_system == Mac)
{
echo "command";
}
else
{
echo "control";
}
Apple macOS Select the About This Mac option in the Apple menu. On the About This Mac window, click the More Info option. Open the Hardware section and find the Processor Name attribute. Once listed, perform an Internet search, using the CPU's processor name as a keyword, to determine if it's a 32-bit or 64-bit CPU.
Is there any difference between Mac OS X and macOS? No, they are essentially the same thing — just named differently. In fact, three terms were used at different times with reference to Apple's operating system: Mac OS X, OS X, and macOS. Mac OS X was the official naming through version 10.7, from 2001 to 2011.
macOS Monterey will be succeeded by macOS Ventura, which was announced at WWDC 2022 on June 6, 2022. Apple Inc. High powered meets "Hi everyone." The operating system is named after Monterey Bay, continuing the trend of releases named after California locations since 2013's 10.9 Mavericks.
Create a 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 it on the header of your site.
After that you can use it like 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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With