html mobile recognition code

Avatar
  • Answered
Hi, On the Immotion website in the Support Centre, under the heading of.... 'How to redirect your website to its mobile version'.......You explain what html code to put into an html desktop website so that when someone views the site on a mobile, they are redirected to a separate page or URL which contains the mobile version. See your instructions copied here: 'Because mobile phones typically have a small screen width, you can redirect visitors to your mobile site if they have a screen width of less than or equal to 800 pixels. You place this code in the head section of your main website code. That way when your site is visited, the java-script will see the browser width and redirect to the appropriate site You can use the following code to do this: PUT IN HEAD SECTION ______________________________________ I put this code into my html website and it worked fine - it redirected mobile viewers to my mobile version of the site i.e. a tall thin column of information with larger text etc. I thought 'great; it works. I tried it on 2 Galaxy android phones, both OK, and on an ipone and ipad, both OK. Also the check procedure on the Google website developers section assessed the site and returned the result 'mobile friendly' so that was great as well. After that I added the code to another site, and when viewing it on my Galaxy Android phones it worked fine, however when I tried them both again, a bit later, they both just displayed the normal desktop view. However on the iphone it was still working OK, and on the Google developers test page, it was still indicating that these sites were 'mobile friendly. So I'm wondering why, even though I hadn't changed the code, the code now isn’t working properly on the android phones. I deleted the cache in my phone to make sure it wasn't showing the cache, but that didn't help. Any thoughts? Many thanks David
Avatar
johnpaulb-imhs1
Hello David, Thank you for your question about an inconsistent mobile redirect. We are happy to help, but will need some additional information. Can you provide a link to the broken redirect. This will allow us to replicate and troubleshoot the issue. Also, since the Mobile Redirect article was written in 2012 originally, you may want to consider making your site Responsive instead. If you have any further questions, feel free to post them below. Thank you, John-Paul