Log in

View Full Version : Updating Mobile Re-Direct Code


Jason Dunn
04-23-2004, 10:00 PM
All Thoughts Media Web sites have code (written by Fabrizio of course!) that detects the incoming Web browser request and serves up either a desktop version of the site, or a mobile version, depending on the client requesting the page. Every so often we update the code to make sure we're addressing as many clients as possible. So here's what I'd like you do to: with your mobile device, visit the site you're reading this on. If you get re-directed to the mobile version, things are workings as they should. ;-) If you're using a Windows Mobile-based Pocket PC or Smartphone, you should be seeing the mobile site. If you're not, odds are you've done a registry hack to change the user agent

For users of other mobile devices, if you don't get re-directed to the mobile site, please go to this URL:

www.pocketpcthoughts.com/tools/ua.php

Record the user agent string it reports, then post it as a comment in this thread so we can add it to our code. Thanks for your help in improving our system!

Jerry Raia
04-23-2004, 10:48 PM
Strange, on my i600 the login page comes up in the mobile format. Once I log on, its all messed up. It looks like the regular desktop page.

The PPC Thoughts pages come up perfect before and after login though.

Jerry Raia
04-23-2004, 10:54 PM
I tried it again, worked for the logged on home page this time but when i navigated to this thread it came up as the non-mobile web page.

Also i noticed on the mobile home page there is no navagation bar of anykind.

rbrome
04-23-2004, 11:31 PM
8O You've really got to come up with shorter URLs!

I can tell you that it doesn't work on a Nokia 6230 - it shows the full site. When I have an hour to spend typing in that other URL, I'll let you know what the UA string is ... :P

Kidding... I wouldn't do that. It's:

Nokia6230/2.0 (03.14) Profile/MIDP-2.0 Configuration/CLDC-1.1

...but are you really doing this with JavaScript? How? That's a client-side technology, and most mobile devices don't support it. How can it redirect when the device can't run the code? Seems like PHP would be the better place to do it.

Also, why try to maintain a list of all user agents for all WAP phones? What a chore! Why not just look for "text/vnd.wap.wml" in the HTTP-ACCEPT header, (then make an exception for Firefox)? That would be much easier, IMHO. :wink:

Jerry Raia
04-23-2004, 11:47 PM
This Site doesnt come up in the mobile format on my iPAQ 5555 either.

Jason Dunn
04-24-2004, 12:04 AM
Strange, on my i600 the login page comes up in the mobile format. Once I log on, its all messed up. It looks like the regular desktop page. The PPC Thoughts pages come up perfect before and after login though.

That's because mobile forums are a subscriber benefit, and we haven't yet launched subscriber services on the site. :wink: I only wanted to know if you can see the mobile site, which is one page.

Jason Dunn
04-24-2004, 12:09 AM
...but are you really doing this with JavaScript?

<cough cough> Um, I was informed that it's not JavaScript. :oops: It's a server-side thing. :D

Also, why try to maintain a list of all user agents for all WAP phones? What a chore! Why not just look for "text/vnd.wap.wml" in the HTTP-ACCEPT header, (then make an exception for Firefox)? That would be much easier, IMHO. :wink:

Good question. We don't have a WAP portal though, so are you saying that WAP phones can render the HTML? I'm a little vague in this area...

Jerry Raia
04-24-2004, 12:33 AM
Strange, on my i600 the login page comes up in the mobile format. Once I log on, its all messed up. It looks like the regular desktop page. The PPC Thoughts pages come up perfect before and after login though.

That's because mobile forums are a subscriber benefit, and we haven't yet launched subscriber services on the site. :wink: I only wanted to know if you can see the mobile site, which is one page.

Then I eagerly await the launch :)

WHEN????? :changes:

rbrome
04-24-2004, 12:47 AM
Also, why try to maintain a list of all user agents for all WAP phones? What a chore! Why not just look for "text/vnd.wap.wml" in the HTTP-ACCEPT header, (then make an exception for Firefox)? That would be much easier, IMHO. :wink:

Good question. We don't have a WAP portal though, so are you saying that WAP phones can render the HTML? I'm a little vague in this area...

Ah - your mobile site is HTML? I assumed it was WML. My bad.

Some newer (non-MS) phones are designed to support HTML, but certainly not a majority. However, most new phones have WAP 2.0 browsers that support xHTML. They're not specifically designed to support HTML, but since xHTML and HTML are so similar, many are "HTML tolerant", essentially providing unofficial HTML support.

Regardless, any browser that has "text/vnd.wap.wml" in the HTTP-ACCEPT header is almost certainly a phone, and shouldn't see the "full" site by default (regardless of the markup language involved). The exception is the new Firefox browser - some versions of Firefox report "text/vnd.wap.wml" in the HTTP-ACCEPT header. But looking for Firefox in the user-agent is an easy way to work around that. It's certainly easier than trying to build a database of user-agent strings for every mobile device out there... 8O

Ed Hansberry
04-24-2004, 03:08 AM
Nokia3650/1.0 SymbianOS/6.1 Series60/1.2 Profile/MIDP-1.0 Configuration/CLDC-1.0

:D

ShivShanks
04-24-2004, 08:15 AM
All Thoughts Media Web sites have code (written by Fabrizio of course!) that detects the incoming Web browser request and serves up either a desktop version of the site, or a mobile version, depending on the client requesting the page.

But what if I don't want to get redirected to a mobile version (and I also don't want to fiddle with my UA string)? I've got a server side retranscoder of content for my browser. So I like seeing the regular site, since that is reformatted to fit in my browser anyway. Plus I get to see all the images etc.

Jason Dunn
04-26-2004, 08:29 PM
But what if I don't want to get redirected to a mobile version (and I also don't want to fiddle with my UA string)? I've got a server side retranscoder of content for my browser. So I like seeing the regular site, since that is reformatted to fit in my browser anyway. Plus I get to see all the images etc.

Normally I'd say to go to this link:

http://www.smartphonethoughts.com/no_sniffer.php

But that doesn't appear to be working at the moment. I'll see about getting that fixed. We have one of those on every site - it's just the index.php page without the sniffer code.

Jerry Raia
04-26-2004, 08:41 PM
So when will this site be fully able to display in mobile format?

Jason Dunn
04-26-2004, 09:06 PM
So when will this site be fully able to display in mobile format?

The mobile home page is working today. Once subscriber services are launched here (which I hope will happen in the next 30 days), the complete forums and every article will be in a mobile-friendly format.

Jerry Raia
04-27-2004, 12:15 AM
Excellent :D