www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascrip redirect w/ full site mobile link not responding, what am I overlooking?

  1. #1
    Join Date
    May 2013
    Posts
    16

    Javascrip redirect w/ full site mobile link not responding, what am I overlooking?

    I'm trying to deploy a small javascript in an existing simple HTML site to redirect mobile visitors to the mobile site, with a 'Full site' link on the mobile site to allow full site access.

    The script I'm testing is from here: http://ezmobilewebsitetools.com/howto-redirect.html

    My main site script:
    Code:
    <script>
    if (document.location.search.indexOf("skipmobile") >= 0) {
    document.cookie = "skipmobile=1";
    }
    else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699)
    && document.cookie.indexOf("skipmobile") == -1)
    {
    document.location = "mobile/";
    }
    </script>
    My mobile site's 'Full Site' link code:
    Code:
    www.domain.com/?skipmobile=1
    My question is, nothing is happening, mobile devices are not being redirected to the mobile site using my above code.

    I originally used this code, but users can't reach the main site.
    Code:
    <!----------  Mobile Device Redirect function ------>
    <script type="text/javascript">
    <!--
    if (screen.width <= 699) {
    document.location = "http://www.mob1.garyluttrell.com";
    }
    //-->
    </script>
    Any suggestions appreciated?

  2. #2
    Join Date
    May 2013
    Posts
    16
    Correction, my main site's code does have the mobile site URL as below:
    Code:
     <SCRIPT LANGUAGE="javascript">
    if (document.location.search.indexOf("skipmobile") >= 0) {
    document.cookie = "skipmobile=1";
    }
    else if ((document.location.hostname.match(/\.mobi$/) || screen.width < 699)
    && document.cookie.indexOf("skipmobile") == -1)
    {
    document.location = "http://www.mob1.domain.com";
    }
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles