Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
91
rated 0 times [  98] [ 7]  / answers: 1 / hits: 15914  / 10 Years ago, fri, january 9, 2015, 12:00:00

A website I'm making has a separate set of files for mobile view due to the html layout being difficult to make responsive.



I'm looking for code that will detect if the user is on a mobile, then redirect them to the m.website.com domain instead.



I found this:



<script type=text/javascript>

if (screen.width <= 699) {
document.location = YOUR-MOBILE-SITE.com;
}

</script>


But on most mobile devices, there is an option to view the desktop version of websites, but it looks like this javascript will ignore that and keep redirecting anyway.



Is there a better way of doing this?


More From » jquery

 Answers
15

This is one of the best module available online,i used the same for my website,it is supported by a major number of mobile devices,many developers has contributed to this repository,might be helpful to you,also it caters for redirection to website through mobile version



Redirection to Mobile Site


[#68268] Tuesday, January 6, 2015, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arron

Total Points: 663
Total Questions: 119
Total Answers: 112

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
;