Jump to content

Getting system information

- - - - -

  • Please log in to reply
3 replies to this topic

#1
ThemePark

ThemePark

    Programmer

  • Members
  • PipPipPipPip
  • 124 posts
I recently found out that the PS3 supports Flash, so I can play Flash games on it if I want to. But the entire website shows up in the browser. So that spawned the idea of making a PS3 version of a website, just like you can make versions for a mobile browser. But is there any way to identify that you're using a PS3 and not a regular PC to browse the internet?

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Of course, my PS3's user agent is in fact the following:
Mozilla/5.0 (PLAYSTATION 3; 4.0.0)

You are lucky as can check for the string "PLAYSTATION" to differentiate rather than having to parse fully. The code should be very similar to mobile detection in Javascript, so feel free to ask if you cannot get a working script.

Possibly this as per a stackoverflow question:
var uAgent = navigator.userAgent;
if (uAgent.indexOf("PLAYSTATION") != -1) {
   window.location = ("http://......./playstation.html");
}


Note: You can do this entirely in PHP so they do not have to load the Javascript, PHP has access to the user agent too.

i.e.
if(stripos($_SERVER['HTTP_USER_AGENT'], 'PLAYSTATION') !== FALSE) {
  if(!headers_sent()) { 
    header("Location: http://........./playstation.html");
  } else {
    //possibly unlikely error condition
  }
}

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
ThemePark

ThemePark

    Programmer

  • Members
  • PipPipPipPip
  • 124 posts
Yeah, after a bit of research I found out about the user agent too. Specifically in JS, there's the navigator.platform property which just prints out Win32, PLAYSTATION 3 or, to my delight, Nintendo 3DS.

I never thought about using PHP, but it's a good idea. But does it also have access to the properties of the user agent?

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

ThemePark said:

I never thought about using PHP, but it's a good idea. But does it also have access to the properties of the user agent?

It is transmitted by the client, so PHP can access it. The bottom code in my post is actually an example PHP script. You could probably run it as is, and modify it with little trouble. This would generally be a good idea if you want the user to go to a separate page , you can as well just tell it to print specific content, or just use Javascript (albeit JS a little slower)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users