Reputation: 2255
I've checked various related questions already posted about detecting mobile devices for websites, but my method is a bit different to anything i've seen and wanted to know if anyone can see any issues with it.
What I'm doing is...
I have a httpmodule that does a server.transfer(); to a blank html page on the first request of a user visit.
On this blank html page is some javascript that detects the viewport width/height and touch capability. The js then saves this info to a client cookie and then redirects (via window.location) to the originally requested page.
When the httpmodule gets hit again, it reads the viewport and touch screen details from the client cookie. If touch is available or the viewport width is less than say 480px then the httpmodule will redirect (via Response.Redirect()) to the mobile version of the website.
Is there any stumbling block I will likely encounter by doing this?
I should note that the tablet version of the site is the same as the mobile, which is why I want to redirect to this version if touch is available.
Upvotes: 1
Views: 153
Reputation: 64
Two issues I can see: latency and touch event availability.
Round trip times are enormously extended over mobile networks: you're looking at about 500ms over 3G for an empty page request. Therefore request - redirect - redirect is about a second of extra latency before the user sees anything. I don't think you'll see flicker - as some commenters suggest - you'll just see nothing for a second, which doesn't seem like a positive experience.
Regarding touch: not all mobile devices are touch based and some that are (Windows Mobile 7) don't have the ontouch* events. You'll need to track these separately.
Viewports are slippery things too: if you aren't forcing the viewport width though a meta tag you'll find a large number of your target devices are missed by a viewport test because they'll claim to be 1024px.
As the touch-enabled devices (iOS, Android etc) all support CSS media queries wouldn't this be a better way to go?
It might be worth taking a look at the RESS (REsponsive design with Server Side components) approach championed by people like Luke Wroblewski: http://www.lukew.com/ff/entry.asp?1392
Upvotes: 2
Reputation: 66641
any issues with it
Its nice idea general, but I think that you also need to check this thinks before the first server transfer. With your method you can avoid to keep an updated database with all the browser info's, I think that sounds good, but its need to be tested if its work smoothly in real world, and also make some more tests before the first server-trasnfer .
Upvotes: 3
Reputation: 1931
Try to use Media Queries which is CSS based and should sort website accordingly. You can detect screen size on the fly and change css accordingly.
http://webdesignerwall.com/tutorials/css3-media-queries
http://www.w3.org/TR/css3-mediaqueries/
Upvotes: 0