Safari Hiding in Plain Sight

121988215 3ada713c82 z

We (sorta) know how Safari got its name, but during the time it was being developed, how did we not know about it? Heck we think we know Apple is working on iOS 7 (and OS X 10.9) through our server logs, how did we miss Safari? Simple, the developers hid it in plain sight.

If you’ve looked at your site’s access logs through Google Analytics (or go old school and look at the raw logs), you’ll see that every time someone visits your site the user agent is logged. The user agent can be lots of things, but one thing it is most often is a web browser. That’s how we know how many people come to a site using Firefox, Chrome, Safari, or (gasp) IE. How did Safari hide from all of us? Simple, it said it was IE for Mac and then a Mozilla browser:

For much of the time we spent developing Safari — long before it was called by that name — it pretended to be Microsoft Internet Explorer. Specifically, Internet Explorer for Mac, which Apple had provided with the OS since 1998. Less than six months before Safari debuted, it started pretending to be a Mozilla browser.

[...]

Back around 1990, some forward-thinking IT person secured for Apple an entire Class A network of IP addresses. That’s right, Apple has 16,777,216 static IP addresses. And because all of these addresses belong together — in what’s now called a “/8 block” — every one of them starts with the same number. In Apple’s case, the number is 17.

IP address 17.149.160.49? That’s Apple. 17.1.2.3? Yes, Apple. 17.18.19.20? Also, Apple. 17.253.254.255? Apple, dammit!

I was so screwed.

Via: Don Melton

As Don points out the reason they had to do this was that Apple has a large, and well known, block of IP addresses so it wouldn’t have taken a rocket scientist to see this odd user agent “Safari” in the logs and match it up with Apple and…secret spoiled.

So they use the most common trick in the book—they faked the user agent. This feature, actually, is still built into Safari in the developer mode—you can switch user agents so you can see how sites will render pretending to be different browsers (very handy for mobile development).

So that’s how. Safari pretended to be someone else on the Internet and didn’t switch until the last minute. Clever.

Photo from Flickr by popofatticus.

Like this post? Share it!

Categories: Apple News, Mac, OS X