DEV Community

Cover image for Have You Wondered How Websites Show the Download Button According to Your Operating System?
Himanshu Singh Tomar
Himanshu Singh Tomar

Posted on

Have You Wondered How Websites Show the Download Button According to Your Operating System?

Like when you visit a website, and it already knows you’re on Windows or macOS — magic, right?
Let’s decode that small but clever trick together.


💭 The Curiosity

A few days ago, while visiting popular websites like VS Code, Zoom, or Slack, I noticed something fascinating.
Every time I opened them, the download button automatically matched my OS
“Download for macOS” on my Mac, and “Download for Windows” when I switched to my PC.

That made me wonder — how does a website even know what operating system I’m using?


⚙️ The Hidden Magic Behind It

Turns out, your browser quietly sends a small piece of information called a User Agent every time you open a website.
It’s like a self-introduction that tells the website who you are and what device you’re on.

Something like this:

“Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0 Safari/537.36”

From that single line, the website can identify if you’re on Windows, macOS, Linux, or even Android/iOS.

Once it knows that, it can personalize what you see:

  • Show the right download button for your OS
  • Change the UI elements or icons
  • Load platform-specific instructions

🌍 Where You’ve Seen It

This isn’t just a small trick — it’s used by almost every major platform you visit:

  • Zoom, Discord, and Slack: Show OS-based download buttons.
  • Spotify and VS Code: Automatically serve installers that match your operating system.
  • Web apps: Adjust UI layouts based on your device type or platform.

These small adjustments make users feel like the site was built just for them.


💬 My Thought

Imagine this — someone opens your website from a Windows laptop and sees a calm, blue Windows-inspired background.
Another person opens it on a Mac and sees a sleek, minimalist macOS-style wallpaper.
And maybe someone on Linux gets a bold, terminal-themed design.

How cool does that sound? 😄
Just by detecting the OS, your website starts to feel more personal — like it actually knows its visitors.

Top comments (0)