I have a website which checks the user agent and loads a mobile version if needed. It loads www.mydomain.com/mobile.
But, like this website "stackoverflow", there isn't a subdomain: it's just "stackoverflow.com" for the desktop and mobile version. How is this done?
Thanks
www is not a subdomain, it's a host name. And what happens here is just DNS in action.
Let's look up www.stackoverflow.com
www.stackoverflow.com. 3600 IN CNAME stackoverflow.com
This says: "www.stackoverflow.com is an alias for stackoverflow.com, look up stackoverflow.com to know the IP address", so now we look up stackoverflow.com
stackoverflow.com. 3600 IN A 64.34.119.12
And there it is, the IP address. That's part 1 of the story.
Regarding the technique SO uses to serve mobile and desktop versions using the same URL, because the StackExchange software that powers SO isn't open source I can only quote Jeff Atwood, from a comment on a blog post regarding the mobile version
unfortunately, that approach doesn’t work at all for sites like us
that are actually serving up different HTML to mobile clients.
which leads me to the speculate that the desired rendering (mobile or desktop) is part of your session, and the page controller just applies another set of templates to the article contents, that are stored in a database.
Related
Is there a way to tell if a mobile page you've downloaded is just a desktop page modified with media queries, or is a separate page designed specifically for mobile? I'd like to go through a list of the "20 Best Mobile Pages" and see what percent were designed specially for mobile.
Let me express my understanding on your task:
You want to check whether one webpage, e.g. https://www.google.com, is designed for both mobile device and desktop computer(it means the two types visit could cause server deliver different webpage), or just for mobile device or just for desktop.
If my understanding is right, the following is my answer:
You could change the "user agent" in your http request, then analyze whether you could get the same or different content from the same URL. About the "user agent", more explanation is here:
https://www.thoughtco.com/detecting-hits-from-mobile-devices-3469093
After you get the contents from different "user agent" settings in your http requests, then if the mobile device's type "user agent" content is different from the desktop's type "user agent" content, then you could assume that URL page is specially designed for a mobile device.
But because there is no special international standard to tell the client whether the content is for mobile or for desktop computer, so it's your job to make this decision after you get the same HTML content from both mobile device "user agent" and desktop "user agent" settings.
Google has a test specifically for this problem, it has API using REST, it can be used with Go,Java, Javascript, PHP, Python and Ruby:
https://developers.google.com/webmaster-tools/search-console-api/
I hope this helps.
Go on the site on desktop, then use Chrome's inspect element to test a mobile sized browser. Then go on your phone and go to the site. If the results are different, then it was designed for mobile, if not then the website was just built to be responsive.
The Google Checkout Mobile website says that "once you've integrated Google Checkout with your website, there's no additional work required to allow customers to buy from you using their mobile devices", but I'm not seeing this happening on either iOS or Android devices I'm testing. The desktop site comes up, which is workable, but not a very good UI on the small screen.
Since there's "no work required", I'm not quite sure how to start to debug this. Ideas?
I took some screenshots of what it looks like iOS 6 and Android ICS.
According to the support forums, Google Checkout for Mobile devices is just a big fat phony.
I'm just going to go out on a limb and post an answer because I noticed in your header link that there was no User-Agent set. The User-Agent server variable is often used to detect if the user is coming from a mobile browser or not. Here is Google's discussion about Mobile Redirects. So, my suggestion would be to try and set the User-Agent in your server-side code prior to your redirect. The whole workflow would be like this:
Detect the user's current User-Agent variable. Here is a PHP example: $_SERVER['HTTP_USER_AGENT'] and store this variable for later use
Receive the URL from Google Checkout
Prior to your redirect, set the User-Agent. This time, it's a cURL example:
curl_setopt($ch,CURLOPT_USERAGENT,$theUserAgentYouDetected); where $ch is the cURL instance. Here is a normal PHP example to set the user agent: $httpRequest->setHeaders(array('User-Agent' => $theUserAgentYouDetected);
Make your normal redirect
I hope this helps
We recently had a mobile site built which was great but when we send out our html emails I'm having to use media queries on the links to send customers to the desktop site or mobile site as the URLs are different Eg. m.mobilesite.com and www.desktopsite.com.
I'd like to use something like 'detectmobilebrowsers.com' so I can do away with the media queries and have one link which is built up of both the mobile and desktop links. The setup advice on this site is not very helpful.
Does anybody know how to do this?
Personally, I don't like the sound of that. You cannot guarantee that the mail/webmail client will be able to support "responsive links", regardless of the device that the user is viewing it on. Hence, you could very well be pointing users to the wrong device specific site.
What I would do, is point all of your email links to the main site version. At that point, you should have some form of device detection in place on your server. Your site logic should be able to forward the user on to the correct site specific page (e.g. mobile visitor sent to mobile version of same page, desktop user not redirected).
If you don't any redirection logic in place (you really should, read this), basically this is what you're looking to achieve:
http://www.9xb.com/wordpress/wp-content/uploads/2012/08/mobile-deployment-small.png
If you're not following the rules laid out by Google regarding redirects and canonical link tags, you may find yourself in trouble at some point.
If this is all a bit beyond your technical ability, I'd suggest you speak with whoever built your mobile site as this isn't for the faint hearted.
here is my what I am trying to do.
I have a .mobi site wayfieldfoods.mobi that is set up on a wordpress format. I am using a plugin that make the site mobile with custom menu wayfieldfoods.mobi/mlp/home.
my clients website is wayfieldfoods.com . How do I add (or redirect) wayfieldfoods.mobi to my clients site? if someone is using a mobile device and types in the url wayfieldfoods.com, I want the mobi site to display instead of the regular wayfieldfoods.com desktop site.
I spoke with someone earlier and they said that it's a code that has to be installed on the index page of my clients wayfieldfoods.com website in order for mobile access to the mobi site.
What is the special code needed to redirect to mobile traffic to my wayfieldfoods.mobi site.
(as a side note wayfieldfoods.mobi shows up on a desktop computer as a regular wordpress site with the default twenty eleven theme, but wayfieldfoods.mobi displays on a mobile phone with the mobile friendly website I set up. It works fine displayed on a mobile phone).
You can use Handset Detection to redirect mobiles to your mobile site (disclaimer : my startup). Browse on over and create a free account. There's a javascript snippet you paste into the of your homepage.
Hope that helps.
I am planning on making a WAP page to provide a software.
Now i need to find out what mobile phone model the client who logs into my webpage is using so that i can redirect him/her to the appropriate download link.
This is similar to what opera does on their opera mini site. When you log in it finds out your model and sends you to the link
How can i add this to my site.
There are a number of solutions for determining mobile device, based on the UserAgent making the request. (Some solutions use other factors as well.)
Try looking at:
WURFL
MDBF
DeviceAtlas
DetectRight
Volantis
MobileAware
Movila
UAProf
The technology you are using to create your pages will also affect which of the above is the best solution for you.
A great website with some tutorials is mobiforge.com (the people behind device atlas), also plenty of true open source software at wurfl