SEO-safe detect mobile user agent (iphone, htc, ...) and redirect to mobile version of website - redirect

What's the best way to automatically detect mobile vs. full screen devices and redirect to mobile site automatically? I'm concerned about SEO so it is safe to do a detection with PHP and redirect to mobile version without unwillingly sending Google to that mobile version?
If PHP is ok, what are good libraries to use?

It is good for usability to configure redirection to your mobile website.
The google webmaster blog has a very important topic on best practices for mobile sites, concerning redirection and duplicate content (!!!)
In my opinioun, a very comprehensive and up-to-date database (including source code in multilple languages) is WURLF: http://wurfl.sourceforge.net/

You don't need any special libraries to do that. User-Agent header will do the trick.

Related

PhoneGap Cordova Browser based and app

Let say were starting a website from the ground up and want to also create apps.
Could you just create the website with a REST API's and have it work on browser and PhoneGap? Would there be a conflict with Cordova plugins you may use?
So the design is responsive and its all HTML, CSS and Javascript and connects to a REST API (log in, reg, messages, db calls, etc) for the browser website and apps.
This way you can use the same code for everything and can still use some of the great Cordova plugins for the app to make it more flexible.
Would this work?
I posted this answer else where but I think it is relevant here.
Unfortunately for your app to pass Apple App store approval it will have to provide some basic functions and display correctly without an internet connection. This means at a minimum, if you plan to generate content on a server you will probably need the Cordova plugin for network information:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-network-information/
I would make sure you are familiar with the Apple Human Interface Guidelines:
https://developer.apple.com/ios/human-interface-guidelines/overview/design-principles/
You will probably also need to bundle any JavaScript. Apple is very picky about apps that download code (this can include JavaScript).
This is a section from the iOS developer Agreement.
3.3.2 Except as set forth in the next paragraph, an Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exceptions to the foregoing are scripts and code downloaded and run by Apple's built-in WebKit framework or JavascriptCore, provided that such scripts and code do not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store.
Another big concern is performance. How will your app handle a poor 3G or even 2G connection? Do you need to cache the responses from the API and only download them if they have changed on the server?
If a user is browsing your website on a browser they know they need an internet connection, if they are using your app they want it to work when online and offline.
Edit
Apple commonly uses this reason for rejection for website only apps.
We found that the experience your app provides is not sufficiently different from a web browsing experience, as it would be by incorporating native iOS functionality.
While your app content may differ from your web site or other existing sites, the experience it provides does not differ significantly from the general experience of using Safari, as required by the App Store Review Guidelines.

What is the best way to redirect pc website to mobile version

I have create a mobile version of my website and i want to redirect from pc to mobile version if user using a mobile. I found few things but let me know what is the best way. It should view any mobile or tablet.
I've used detect mobile browsers with good success. It has lots of downloadable script options like .htaccess for an apache server, php script, jQuery, perl and plenty of others.
It's a good starting point.
Good luck!

I want to convert my HTML site into iPhone or Droid compatible site. How can I do that?

My website is really very simple HTML based site. My site is located here: http://www.threesite.com
How can I convert this simple HTML site compatible with iPhone or Droid? Do I need to convert the same into PHP based site and then convert? Your help will be much appreciated.
5 Ways to Create or Convert into Mobile Phone Website.
The easiest way is to use Google's tool, because it converts your existing site automatically. I've tried it on your site and it looks nice.
If you want to tailor the site yourself, you have two options: Building an app or rewriting HTML. A site app makes your site highly customizable and professionally-looking, but it requires a lot of effort and separate development for each platform (iPhone, Android, Blackberry, Symbian, ...), and. it requires your users to specifically download your app.
If you choose to convert the existing HTML to a mobile-friendly site, it will be (mostly) cross-platform, and you can follow the guidelines here.
This is very interesting question especially these days when mobile visibility has never been more important.
For more complex website I would use some online mobile site converter service, such as duda mobile or bmobilized.
These services will give you just mobile - 'm' version of a website, but with long bad urls, and unless you pay for responsive package, the site won't work on tablets.
Maybe the best solution is to use joomla or word press and pick some responsive template and build the website from scratch. Building one responsive site is better solution than having multiple instances for each device...
examples:
a) duda service
If you wander what duda can do for you, just as an example, check this site crazyscarygames.com and check out his 'm' counterpart "m.crazyscarygames" for mobile devices. this is just an example.
b) script
If you would go for full responsive site, this is an example of purity III template on this website monkeygamesworld.com ... m.monkeygamesworld.com
And remember, always do all redirects from htaccess.
There's a google tool that you can use in the end to verify how your site works on android
google.com/webmasters/tools/mobile-friendly
just enter url and hit 'analyze'
also make sure that your robots.txt is setup well, in order to allow google bot do its scan properly throughout necessary directory structure in order to access all resources.
ok, hope that helps

Mobile Specific Site Development. Where to start?

I'm beginning the process of learning the ins and outs of developing sites for mobile web browsers. Are there any good resources/communities online that discuss mobile specific site development issues?
My initial understanding is that to cover different phones you need to build one site that is enabled for browsers with the webkit engine (iphone, android, etc.) and another more basic site for other older browsers, is this assumption correct?
Also what does developing for webkit mean exactly? How is it different than just using javascript/css/html? Is it the same except that you limit yourself to webkit specific functions and css? I looked on the webkit site, but it didn't explain it in those terms.
Are there any other snafus I need to watch out for when developing for mobile browsers?
Your assumption is correct, you will need to develop multiple versions of your site targeted at different browser types.
Webkit is the engine used by Safari (mobile Safari), Chrome, and Andriod Browser (mobile Chrome?) you can use standard Javascript, XHTML, and CSS, the main thing, is making your site "fat-finger-friendly" since these devices are all driven by touch screens.
What I mean by "fat-finger-friendly" is that you have large links/buttons that are easy to hit with your finger, most mobile browsers are good at approximating which link you intended to touch, but if you have alot of stuff jammed together, it frequently gusses wrong.
Another consiteration is screen size, and thus the width/height of your site.
The best illustration I have of this is from Ars Technica -- checkout their site in your desktop browser, then check out their site in your mobile browser. Its a very slick version of the site. (http://www.arstechnica.com/)
Webkit is rendering engine designed to allow web browsers to render web pages. It provides the set of classes to display the web content in windows and implement different features which are provided by browser (such as links, fwd/backward etc).
You don't need to build the different sites for different rendering engines such as webkit. Designing of mobile web site should consider the screen size and how different components look/behave in different rendering engines.
Look at this question for more details of how to build the mobile friendly site.
If you want to support older browsers, then you should have multiple sites. But take a look at mobile browser stats first to decide if it's worth it. If you just want to make your existing website work for iPhone/Android or other phones with A-grade browsers, then you can customize with a mobile friendly CSS (for small screens). But to get good performance on mobile devices on slow/unreliable connections, you probably need to have a separate stripped down html.
Apple has a very good guide to help you optimize your site for iPhone. Most of it will also work on modern mobile browsers:
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html
Peter Paul Koch has done an excellent research on different mobile browsers. He has several articles, but this one is a good start:
http://www.quirksmode.org/mobile/browsers.html
Like Nate Bross mentioned, you should optimize for touch devices. Unfortunately it's very difficult to know if a device has touch or not, since there is no media query for it. You can do user agent sniffing for some devices, but I don't recommend it. More discussion here: Optimize website for touch devices
For the moment, I detect touch events (with an exception for Chrome). If this returns true, I inject a touch CSS. A bit nasty, but the other options are worse:
function() {
if( /Chrome/i.test(navigator.userAgent) ) {
return false;
}
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
}
You specifically asked for sites for mobile web browsers, but you might also check out the possibilities of creating a mobile web app. It looks like an iPhone app (or Android for that matter), but it's built with the help of HTML5. You can do pretty slick animations with the CSS3 in the webkit image, and iPhone also has meta tags to hide the Safari navigation toolbars. Users can then bookmark your page to their home screen, and it will work just like a normal iPhone app. Of course you're limited to the browser and it's performance. But you can create multiplatform apps :) HTML5 + JS is the only multi-mobile-platform language Steve Jobs approves, and with the help of PhoneGap you can even get it into the AppStore!
If web-app sounds interesting you should check out jQTouch, jQuery CSS Transition plugin and of course Building iPhone apps with HTML, CSS and JavaScript by Jonathan Stark.
If your site is pretty simple (just content delivery) I'd suggest a service like mobify: http://mobify.me/
A lot of big publications use it, and I have too. In fact, Ars Technica (which Nate Bross pointed to in an earlier reply) uses this service to display their mobile content.
You have control over style, and that's about it, so if your site is more complex it might not be for you. Otherwise, it's a good service. You can have a mobile site up almost as quickly as it takes for the DNS for your mobile site's address to update.
I disagree that you need to build multiple versions of a Web site.
One simple HTML5 Web site will work across all mobile browsers and desktop browsers too.
The beauty of the latest developments of HTML5 is that you could use new Iphone/Android features like Geolocation, and older browsers will simply ignore the JS code if you carefully put it within try catch statements.
For "fat finger" type problems you can serve a different CSS which makes buttons bigger if you really must. Good browsers should make default buttons easy to press in any case.
Keep it simple and you won't have to see these fragmented & costly device dependent approaches. Write HTML5 by hand and use a validator. Good luck!

How to direct my users to my iPhone enabled site?

I have made an iPhone friendly version of my site, that I want to direct my users to.
The big question now is how to direct my users to this site. There are a few alternatives:
Redirect the user based on the user agent, e.g. if the user agent sent by the browser contains "iPhone" or android or whatever.
If the user agent matches the above criteria, display a notice on the original site telling the user that an iPhone version is available.
Which one is the most user-friendly? Another dimension to consider is the SEO aspect. How do I show Google that my site is iPhone capable?
I recently found some relevant posts on the Google Webmaster Tools homepage:
Help Google index your mobile site
Running Desktop and mobile versions of your site
phidah above has some good links, but remember: always include a link to view the desktop version. nothing is more frustrating than a limited mobile version when the desktop works just fine on the iPhone. there are exceptions, of course - for example if your desktop is mostly flash :p
This strikes me as more of a user experience question than a programming design decision. I would build either solution depending on what makes sense for your site, and your users. If you do go the redirect route, and the content on both version of the site are the same, I wouldn't worry to much about google. If the content is different, I would make sure both sites are visible to googlebot.
Nearly every site that I visit that has a mobile/iPhone version that just redirects me automatically, and then at the bottom there is a link to go to the full version if I want.
For SEO I don't think this would hurt anything, since web crawlers aren't run on mobile devices.
Check out the links below.
web dev kit
and for css info on detection
css Info
it is some of the better info I have found, hope it helps.
Kirk