+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sitefinity and Mobile

Sitefinity and Mobile

3 posts, 0 answered
  1. Belinda
    Belinda avatar
    12 posts
    Registered:
    26 Sep 2013
    26 Sep 2013
    Link to this post
    Hi--We have a site developed in Sitefinity and several of those pages are specifically for mobile.  I was under the impression that if you typed in one of our url's on a mobile device, the mobile page version would show up.  So for example: if I typed in:  www.hithere.com/training, if we have a mobile page that corresponds with that it would automatically bring up: www.hithere.com/mobile/training.  But its not doing that.  It brings up the full site subpage for a brief instant and then just automatically goes to the mobile homepage.  Any clues?  Thanks!
  2. Belinda
    Belinda avatar
    12 posts
    Registered:
    26 Sep 2013
    27 Sep 2013
    Link to this post
    No one has an answer to this????  This is the javascript that is in the mobile pages:  http://jsfiddle.net/Zmgfp/

    Is this what is redirecting every page to the mobile home page?
  3. Jochem Bökkers
    Jochem Bökkers avatar
    787 posts
    Registered:
    13 Aug 2007
    28 Sep 2013 in reply to Belinda
    Link to this post
    Hey Belinda,

    No the code that takes care of it is this:
    <script type="text/javascript">
        var _rdDeviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
        var _rdDeviceHeight = (window.innerHeight > 0) ? window.innerHeight : screen.height;
        var _rdOrientation = (window.width > window.height) ? 'landscape' : 'portrait';
        if((screen.width > 240) && (screen.width < 320)) {
            if(!(window.location.toString().toLowerCase().indexOf('http://www.hithere.com/mobile/training') == 0 || window.location.toString().toLowerCase().indexOf('/sitefinity') > 0)) {
                window.location = 'http://www.hithere.com/mobile/training';
                }
        }
        if((screen.width > 320) && (screen.width < 480)) {
            if(!(window.location.toString().toLowerCase().indexOf('http://www.hithere.com/mobile/training') == 0 || window.location.toString().toLowerCase().indexOf('/sitefinity') > 0)) {
                window.location = 'http://www.hithere.com/mobile/training';
            }
     }
    </script>

    (edit: the ruleset might vary ofcourse, this was just a demo ruleset, your pixel values will vary)

    The most likely reason why you're seeing your page rendered first is because you've got those scripts you've mentioned in your head tag.

    The redirect script inserted by Sitefinity appends to the end of the head, so your scripts get referenced prior to that. Since document.ready won't fire in the head of the page anyway its best to move all JS to the body closing tag.
3 posts, 0 answered