Jump to content

Mobile Site


fiveworlds

Recommended Posts

@media or do you mean something else?

 

I use the @media queries just fine and I can detect if it is a phone or tablet in php. But there is a way for the phone to be able to switch to desktop site from the options menu and it doesn't do anything on mine.

Link to comment
Share on other sites

What does the script do in terms of modifying the css?

 

 

As far as I can tell it modifies the useragent for instance in firefox on my phone. I'm after testing it on my server and it gives me.

 

Request Desktop Site

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24

 

Request Mobile Site

Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HUAWEI Y625-U21 Build/HUAWEIY625-U21) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

 

Do I just test for the mobile string or is it more complicated than that??

 

Okay so having looked at https://developer.mozilla.org/en-US/docs/Web/HTTP/Gecko_user_agent_string_reference I need to test for both the mobile and tablet strings. On Chrome I just need the Mobile string they don't differentiate between tablets and mobiles https://developer.chrome.com/multidevice/user-agent. Don't know the stock ios browser string though.

Edited by fiveworlds
Link to comment
Share on other sites

Typically you have different versions based only off of screen size. One way I've found to change versions is to disable the style sheet containing the media query for the mobile version.

 

Per device coding could easily end up being a ton of work.

 

I don't know if you already have, but looking at the forum's coding on this might also prove useful.

Link to comment
Share on other sites

So on my phone I have the ability to request desktop/mobile site. I can't seem to find a tutorial on how to specify this though. I just make the site responsive so it only has one version.

Print HTTP headers in PHP, or so, f.e.

http://php.net/manual/en/function.getallheaders.php

when mobile goes to your website,

and when computer goes to your website.

And learn what are differences between requests.

Link to comment
Share on other sites

when mobile goes to your website,

and when computer goes to your website.

 

 

 

Okay ...

 

Request Desktop Site

Host: Mypublicip.58Connection: keep-aliveCache-Control: no-cacheAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24Accept-Encoding: gzip,deflateAccept-Language: en-GB,en-US;q=0.8X-Requested-With: com.android.browserx-wap-profile: http://wap1.huawei.com/uaprof/HUAWEI_Y625_U21_UAProfile.xmlx-GETzip:supported

 

Request Mobile Site

Host: Mypublicip.58Connection: keep-aliveCache-Control: no-cacheAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HUAWEI Y625-U21 Build/HUAWEIY625-U21) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30Accept-Encoding: gzip,deflateAccept-Language: en-GB,en-US;q=0.8X-Requested-With: com.android.browserx-wap-profile: http://wap1.huawei.com/uaprof/HUAWEI_Y625_U21_UAProfile.xmlx-GETzip:supported

 

On Desktop

Host: localhostUser-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-US,en;q=0.5Accept-Encoding: gzip, deflateCookie: phpbb3_ouovk_k=; phpbb3_ouovk_u=1; phpbb3_ouovk_sid=60a36c22702b6feb27b27670e0462bb2; __atuvc=4%7C28; web_vid=4805587476023148; _ga=GA1.1.1199525272.1449251808; __utma=111872281.1199525272.1449251808.1449604637.1454106518.3; __utmz=111872281.1449263887.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); AMCV_1E24776A524450D90A490D44%40AdobeOrg=793872103%7CMCIDTS%7C16778%7CMCMID%7C57254221660899275021091413416995335385%7CMCAAMLH-1450209436%7C6%7CMCAAMB-1450209436%7CNRX38WO0n5BH8Th-nqAG_A%7CMCAID%7C2A98B3D00530997F-4000030460008FD2; _js_datr=8n3UVrlD76ex_8AGUoCyrRJ8Connection: keep-alive

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.