Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Redirecting users to mobile version of site

7:46 pm on Jul 3, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:Mar 19, 2010
posts: 51
votes: 0

I wasn't sure what forum this belonged in but here's the issue I'm having...

I am using the following code in my websites pages...

<!-- CSS -->
<script type="text/javascript">
if (screen.width <= 699) {
window.location = "http://m.example.org/";
<!-- CSS -->

That code determines the screen width and if it's less than a certain amount it redirects the user from the main desktop site to the mobile version of the site. It works perfectly, however there is one issue...

When the user clicks the 'View Full Site' button on the mobile site it takes them to the full site but then loops them right back to the mobile version since it has determined their screen width is too small.

Is there a way I can remedy this because it seems to be eluding me...

[edited by: bill at 1:09 am (utc) on Jul 4, 2013]
[edit reason] use example.org [/edit]