mobile version website -- m.website.com
I having few websites which host by hosting company using PHP + MySQL
It is so common that website having mobile version.
The address link of mobile version website usually like this: m.website.com
I wondering howto develop a mobile version add on my current normal website?
Could anyone share their experience on making of mobile version?
found something after google:
When any browser talks to you, one piece of metadata that it provides is whether it claims to be a "mobile" device or not. (Incidentally, browsers on mobile devices normally allow you to switch that on or off ...)
When the "main" web site observes this metadata, it normally issues a redirect to the "m." site (which does the opposite).
Then, whether or not there are actually two separate services on the back-end providing the output in each case, the two follow different paths: most especially, the use of different templates to handle the generation of appropriate HTML.
In programming-language terms, I happen to like to define "the web service" as a programming-language object in three parts: (1) a base-class; (2) a "non-mobile" child class; and (3) a "mobile" one. Any of which might be further subdivided, e.g. to handle browser-differences or mobile-device differences. Where differences exist, the child-classes override the appropriate handlers while passing most of the actual work to their inherited parent. What I am consciously trying to do here is to factor-out the complexity that otherwise can very-easily permeate the source-code of the application.
I also define an object for "a request" (and "the response"), and each of these specifically has an attribute such as is_mobile, so that there is "one, and only one, Official Way™" to recognize the two cases in code that is common.
Remember that we certainly have not seen the end of the evolution of just what "a mobile device" means, nor of what such a thing can do. Design for the future, knowing that the future will very-quickly arrive.
ratio of mobile device -- screen.height divide by screen.width
The above link got the info of screen size, dimension, pixel of many mobile devices.
What the following code do is:
By the height and width of the pixel screen size, then get the ratio/scale of mobile device, and so redirect to different .html/css file.
Please check, have a look anything wrong the following code. Simply copy and paste into a .html file
|All times are GMT -5. The time now is 03:21 AM.|