Detect Hits From Mobile Devices on Web Pages

Redirect mobile devices to mobile content or designs

Detect Hits,For years now, experts had been saying that traffic to web sites from site visitors on cell gadgets has been growing dramatically. For this motive,

many corporations have neatly started to embrace a cell method for their on-line presence, creating reports which might be proper to phone and other mobile devices.

Once you have got spent the time mastering a way to layout web pages for cell telephones, and imposing your approach,

you will additionally need to ensure that your website online’s site visitors can see the ones designs. There are many ways you could try this and some paintings higher than others. Here’s a have a look at the method you could use to implement mobile help on your websites – along with a advice close to the quit for what the first-class method to acquire this is on modern-day net.

Provide a Link to Another Site Version

This is, by means of far, the perfect technique to deal with cell phone customers. Instead of disturbing whether or not they are able to or cannot see your pages, without a doubt positioned a link somewhere near the top of the page that points to a separate mobile model of your web page. Then the readers can self-choose whether or not they want to peer the cellular version or continue with the “normal” model.

The advantage of this solution is that it’s easy to enforce. It calls for you to create an optimized model for mobile after which to add a link someplace close to the top of the normal web site pages.

The drawbacks are:

  • You need to keep a separate model of the website online for cell users. As your website gets larger, you can forget about to hold that 2nd version and your websites should fall out of sync.
  • Do you furthermore mght create a third version for pills? How about a fourth model for wearables? This concept of device-particular versions can spiral out of control in no time.
  • You ought to put an unsightly hyperlink at the pinnacle of the page that non-cell readers can see (and likely click on).

Ultimately, this method is an previous one this is not likely to be a part of a cutting-edge cell method. It is every so often used as a stop-gap repair while a better solution is being evolved,

but it’s far certainly a short-term band-useful resource at this point.

Detect Hits,Use JavaScript

In a version of the above-mentioned technique, some builders use some type of browser detection script to discover if the purchaser is on a cellular tool after which redirect them to that separate cell site. The trouble with browser detection and cellular devices is that there are heaps of mobile devices out there. To try and come across all of them with one JavaScript ought to flip all of your pages into a downloading nightmare – and you are still challenge to some of the same drawbacks because the above-referred to approach.

Detect Hits,Use CSS @media Handheld

The CSS command @media hand-held looks as if it would be a really perfect manner to show CSS patterns just for hand held gadgets — like mobile phones. This seems like a super answer for showing pages for cellular devices. You write one Web page after which create two fashion sheets. The first for the “display screen” media kind patterns your web page for monitors and computer monitors. The 2d for the “hand-held” patterns your web page for small gadgets like the ones mobile telephones. Sounds smooth, but it would not surely paintings in practice.

The largest gain of this technique is which you do not must maintain two versions of your website. You just maintain the one, and the fashion sheet defines how it should appearance — that’s in reality getting toward the cease answer we need.

A problem with this technique is that many phones don’t help the media kind — they show their pages with the display media type as an alternative. And many older cellular phones and handhelds don’t help CSS in any respect. In the quit, this approach is unreliable and is consequently hardly ever used to deliver cellular variations of a website.

Use PHP, JSP, ASP to Detect the User-Agent

This is a miles higher manner to redirect cell users to a mobile version of the website because it does not depend on a scripting language or CSS that the mobile device doesn’t use. Instead,

it uses a server-aspect language (PHP, ASP, JSP, ColdFusion, and so forth.) to examine the user-agent and then alternate the HTTP request to factor to a cellular web page if it’s a cell device.

A easy PHP code to do this could appear to be this:

The problem here is that there are masses and plenty of different capacity person-marketers that are used by cellular gadgets. This script will trap and redirect a number of them however now not all through any manner. And extra are brought all of the time.

Plus, as with the opposite solutions above, you may need to nevertheless ought to keep a separate cell web page for these readers! This disadvantage of having to control two (or greater!) websites is purpose sufficient to are searching for out a better solution.

Detect Hits,Use WURFL

If you’re nevertheless determined to redirect your cellular users to a separate website online, then WURFL (Wireless Universal Resource File) is a good solution. This is an XML report (and now a DB document) and numerous DBI libraries that now not handiest include up to date wireless user-agent statistics but also which capabilities and talents those person-retailers support.

To use WURFL, you download the XML configuration report and then choose your language and implement the API on your internet site. There are gear for the usage of WURFL with Java, PHP, Perl, Ruby, Python, Net, XSLT, and C++.

The benefit of the usage of WURFL is that there are plenty of humans updating and adding to the config file all of the time. So even as the document you’re using is out-of-date nearly before you have finished downloading it,

possibilities are that in case you down load it once a month or so,you may have all of the mobile browsers your readers habitually use with none problems. The disadvantage, of direction, is that you have to continually down load and replace this – all so that you can direct users to a 2nd website and the drawbacks that creates.

The Best Solution Is Responsive Design

Detect Hits,So if retaining special sites for one-of-a-kind gadgets isn’t always the solution, what’s? Responsive web design.

Responsive design is wherein you use CSS media queries to define patterns for gadgets of numerous widths. Responsive layout lets in you to create one Web web page for each cell and non-cellular users. Then you do not should fear about what content to display on the cell website or do not forget to switch the trendy changes on your cellular website. Plus, once you’ve got the CSS written, you don’t have to download whatever new.

Responsive layout won’t work perfectly on extremely vintage gadgets and browsers (most of which might be in very small use today and ought to now not be a whole lot of a fear for you),however because it is additive (adding styles onto the content,

in preference to taking content away) these readers will nevertheless be capable of read your internet site, it simply might not look best on their antique tool or browser.