Jonas Stawski

Everything .NET and More

Kind Of Emulating iPhone or iPod Touch With Safari 4 Beta

The iPhone revolutionized how Mobile Web Browser Clients render content and, let’s face it, there are millions of users out there who use the iPhone or the iPod Touch to navigate the web. The number of people is so huge that many websites have specific versions of their websites just for iPhone users, but what about if you are a web developer and are in need of developing an iPhone friendly website and do not have an iPhone to test?  You have a few choices and one of them is User Agent Spoofing. What is User Agent Spoofing? Well let’s start by explaining what is the User Agent. Basically, the User Agent is a string that defines the Web Browser and is passed to the server of the page the user is visiting. Hence User Agent Spoofing is the act of changing the User Agent to fake to the server the identity of the browser (kind of like Identity Theft :)). User Agent Spoofing is nothing new in the Web Development community, but the cool thing about Safari is that it comes with a built in way to spoof the user agent. Why is this cool if it is not new? Because the iPhone and iPod touch browser are both Safari browsers and by changing the User Agent to the iPod or iPod Touch Safari browser we can test how our web sites will render on the iPhone. You might ask what is the difference between the Safari User Agent Spoofing and the other spoofing techniques/tools? From the point of view of spoofing there are no difference, but by using the Safari rendering engine we know we are using almost the same rendering engine as the iPhone. With this technique you won’t be able to zoom in and out, simply check how the page renders hence the tile of this post (Kind Of). Enough of talk, show me how to do it!

With Safari 4.0 Beta you will have to first enable the Develop menu and you can do so by clicking on the star on the right hand side by the toolbar and going to Preferences:

image

Go to the advances tab check the “Show Develop menu in menu bar”:

image

Close out of the preferences and go to the Develop menu on the menu bar (if it is not showing press F10 to show it), User Agent, and then select Mobile Safari (there are 4 versions: 2 for the iPod and 2 for iPhone)

image

Happy Testing!

Comments (2) -

This might be nice for people who'd like to try some stuff before buying it. Obviously you'd probably have to pirate it first to test and since you're going to pirate it anyways you might just jailbreak the phone.

Reply

The number of people is so huge that many websites have specific versions of their websites just for iPhone users, but what about if you are a web developer and are in need of developing an iPhone friendly website and do not have an iPhone to test?  You have a few choices and one of them is User Agent Spoofing. What is User Agent Spoofing? Well let’s start by explaining what is the User Agent. Basically, the User Agent is a string that defines the Web Browser and is passed to the server of the page the user is visiting.

Reply

Add comment

biuquote
Loading