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
189 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
ID: 39910997
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
ID: 39911007
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
ID: 39911024
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39911028
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 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39911379
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
ID: 39915293
Thanks!
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39915403
You're welcome.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

816 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

13 Experts available now in Live!

Get 1:1 Help Now