Hi,
I was wondering if anyone could tell me how exactly a website knows if you are visiting from your computer (ie/firefox) or from your cell phone browser???
For example, if I go to http://mobile.google.com in firefox, it is a different webpage than if I use my mobile browser.
I just need to know how it works, or how I can access the mobile version of a webpage on my PC?
Any info will help!
|
Go4Expert Founder
|
![]() |
| 1Oct2007,04:41 | #2 |
|
It totally depends on how the web site owner has setup his website. Lets say you are a site owner and when you detect a mobile web browser you redirect them to page a and when its PC user you redirect them to page b. Now by no means when you are at your PC you can view the page a because it will redirect you to page b and vice versa.
Now I think there should be a way to fool the coding out there but for that you should be doing some RnD. First have a website page where you can get the details about your mobile page like browser type / OS. Now using the Firefox browser agent have your details as if you are on mobile and try browsing the website using that agent and you may have some success but I am not sure about it. |
|
Go4Expert Member
|
|
| 5Dec2007,01:01 | #3 |
|
Use the phpinfo() function to return all of the variables associated with PHP. Towards the end of the page that has loaded within your web browser you will see the _SERVER variables. One of these variables, _SERVER["HTTP_USER_AGENT"], will return the description of the web browser you are using (I've omitted the dollar sign in front of the _SERVER, just in case it plays havoc with the forum !!)
As a quick test, using IE6, the server variable returns "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; www.lifetranslator.biz; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)". Using Firefox returns "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9". (tested on Windows XP Professional platform, using Apache Web Server) Now if you create a simple index.php page and use a switch statement looking for specific information within the _SERVER["HTTP_USER_AGENT"] variable, you will be able to redirect web browsers on different platforms to the correct code pages. |

