Solved

How do we get the browser to switch to a mobile version of our site when using a mobile phone?

Posted on 2014-03-06
7
185 Views
Last Modified: 2014-03-08
I have a site, that we would like to switch to a mobile version when users viewing from a mobile browse on phones.  looking for info on how to do this
0
Comment
Question by:bmanmike39
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
You need to design a responsive version of your site or build a mobile version of your site that will only show on mobile devices
Multiple frameworks are available for designing a responsive site like Bootstrap
0
 

Author Comment

by:bmanmike39
Comment Utility
I know that,  How do we make it switch over or detect if its a mobile device or not?
0
 
LVL 58

Expert Comment

by:Gary
Comment Utility
A responsive website does that automatically based on CSS media queries.
If you are designing a separate mobile site then you need to use javascript to detect the browser/device and redirect to the mobile version
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
Ideally, you don't detect mobile. You simply design a site that will adjust itself according to the measurements of the viewport. Frameworks like Bootstrap will do this for you automagically. In the very worst case, you rely on user-agent detection, but this is unreliable and a brittle design. Stick with a framework that yields a responsive design. There might be a learning curve, but it will often be less work in the end.
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
My customer chose this method based on screen size to give them a choice.  A lot of 'mobile' devices have screens large enough to use the desktop sites.
<script type="text/javascript">
<!--
var t1=screen.width;
var t2=screen.height;
var t5=screen.availWidth;
var t6=screen.availHeight;
function myFunction()
{
if(t1 < 484 || t2 < 484) {
	var r=confirm("We have an alternate view for smaller screens.  Would you like to try it?");
	if (r==true)
  	{
	  window.location.assign("http://www.yoursite.mobi/")
  	}
	}
}


// -->
</script>
</head>
<body onload="myFunction()">

Open in new window

0
 

Author Closing Comment

by:bmanmike39
Comment Utility
Thanks!
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
You're welcome.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ust html in ms/access WebBrowswer 11 41
CSS grid style change 2 13
Jquery autocomplete 10 19
Problem to page 4 16
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now