Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


How do I detect the Sony PSP Web browser on my site?

I'm looking to make a Sony PSP optimized website, but I want it so that it can only be viewed by the PSP and if viewed in a normal pc internet browser, you have a message saying "please visit us using your psp" or something along those lines. How do I do that?


Dave's Answer:

This is a very cool question and one that turns out to be pretty easy to solve once you realize that all Web browsers return information about themselves using a CGI environment variable called HTTP_USER_AGENT.

I wrote a quick little shell script that displays the calling environment when accessed via a browser and used that for testing:

#!/bin/sh

echo "Content-type: text/html"
echo ""
echo "<pre>"
env
echo "</pre>"
exit 0

When this script is invoked from Apple's Safari browser, for example, I see:

HTTP_USER_AGENT=Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) 
    AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8

but when I go to my Sony Playstation Portable (PSP) and use its built-in Web browser to access the very same script, I see:

HTTP_USER_AGENT=Mozilla/4.0 (PSP (PlayStation Portable); 2.00)

So that's your answer. You need to check the value of HTTP_USER_AGENT to see if it contains the sequence "PSP". You can do that within a CGI script or with a scripting language like JavaScript, depending on your preferences.

There's also a second variable you could check for that I've only ever seen with the PSP browser:

HTTP_X_PSP_BROWSER=2.60 (LX)

I talk about how to accomplish this sort of conditional page delivery in my book Creating Cool Web Sites with HTML,XHTML and CSS too, as it happens!

Hope that gets you moving in the right direction!


More Useful iPod, Sony PSP and MP3 Player Help Articles:
✔   Deleted iTunes library but still have tracks on iPod...
Hi Dave, I have been following your newsletter for awhile now. Most of your topics are way over my head but very interesting....
✔   How do I fix the time / date on my Apple iPod Touch?
I pulled my iTouch [ed note: "iPod Touch", actually] out of the drawer and when it was fully charged I realized that the...
✔   Can I remove songs from an unsync'd iPod Touch?
My son has just come home from his uncle's house with a new iPod. Very nice. Full of a wide variety of music,...
✔   Get started with iTunes Match!
I have a huge library of music, Dave, and want to be able to enjoy it on all my Apple devices, but am...
✔   Can I pre-order a music CD from the Apple iTunes Store?
I have a bunch of bands and musicians I follow faithfully and when I see that there's a new CD coming out from...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  









Reader Comments To Date: 10

Auri said, on January 14, 2006 10:56 AM:

I have an article about how to do this in ASP.NET 2.0 so it automatically detects and reformats the page for the PSP browser...

Here ya go:

http://community.hackingpsp.com/forums/283/ShowPost.aspx

Best,

-Auri

jman said, on July 24, 2006 1:09 PM:

DAVE THESE ARENT HELPING ME I JUST WANT TO GET INTERNET ON MY PSP I TRIED MAND SITES I HAVE A USB CABLE TO AND A DNS CABLE IT DOESENT DO ANY THING AND WHEN I CONNECT MY USB CABLE TO THEY COMPUTER THEN IT SAYS CONNECT A USB CABLE WHEN I GO TO SETTING AND CLICK TEST USB CONNATION OK I JUST WANT TO KNOW HOW TO GET INTERNET AND PLAY ONLINE GAMES THATS ALL I ASK

Tim said, on July 30, 2006 4:17 PM:

For the guy above, the PSP connects to the internet through a wireless connection, not through any cables. Even if you lack any common sense, at least read the damn manual, or even the box it came in. I'm surprised you actually used a computer to type that.

Danny said, on April 13, 2007 6:10 PM:

Tim, i couldnt agree more....people who dont read their hand books/ manuals have no grounds to ask questions to answers they could solve themselves....COME ON PEOPLE! if you arent going to read the manual than AT LEAST google "How to connect my psp to the internet" DUH......people aggravate me soo....much

Brandon said, on May 8, 2007 4:18 PM:

Yeah..I guess Sony didn't figure you'd need to connect to the internet with USB. Since that would imply that you are sitting in front of a perfectly capable, internet ready PC in the first place ;P

james said, on March 1, 2008 8:12 PM:

when does psp version 4.00 come out for psp? and what will it include

Malcolm Bevege said, on April 5, 2008 1:33 AM:

Is it possible to read CGI scripting from the PSP.

I would like to read the cgi from my satellite internet terminal in order to see connection status and so on.

Phil said, on May 23, 2008 6:45 AM:

Hi Dave,

I have a question or three about the PSP browser.
Let’s just say I’ve gone through the rigmarole of buying something online using a credit card on my PSP. How secure is that? And also as the browser is mainly running from memory stored in the PSPs internal memory as opposed to memory stick itself - what type of memory is it, can it be accessed by anyone, could sensitive information be ‘data recovered’ and does it truly delete History, Bookmarks, Cache, cookies etc?
When you go into the device, you can see your memory cards' files, but not the PSPs internal memory.

Please enlighten me and I’ll buy you a coffee. Thanks..

DJKMan said, on November 25, 2008 9:57 PM:

Tim, I definitely agree with you. :D


James, as of now, that question would be old. If that firmware was a future firmware I would reply with something along the lines of this: It is not possible to know until Sony or someone official leaks the information. The only sure way to know is to wait. Patient pays off...most of the time.

Phil, the psp's browser is very secure according to me due to its limitation. When you delete everything on the psp, it truly does delete everything except the bookmark.html file. A person will not be able to recover your sensitive information directly from the memory stick. I recommend not buying things online on the psp as the psp's browser tends to run out of memory quickly (on the phat usually) and it will cause the page to fail after the "Out of Memory" error comes up. This means that if it fails and you reload the page in the middle of a transaction, you will end up paying twice. The sensitive information can also be obtained if you are not careful online. For example, you use your credit card on a fraudulent site.

I hope that helps. :)

nick said, on January 2, 2010 9:14 PM:

plzzz dave help me i want to know how come i can't chck my email on psp when try to go to moblie site it say sve only 3kb when it done nothing ....??? ppl hv been saying i hve to connect 2 ma pc and stuff does tht really wrk cause i can rarely go on ma pc cause parents bought this plzzz help thx in advnce hurry

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

I do have a comment, now that you mention it!











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.