Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Vincent Baaij 95 posts 344 karma points c-trib
    Dec 17, 2010 @ 16:54
    Vincent Baaij
    0

    Redirect all pages to mobile site with altTemplate and 51degrees detection

    Hi all,

    Been trying all day and can't get it to work :(

    I'm using the iPhone alttemplate to present all pages in my site on a mobile device. To detect if redirection is needed, i'm using the module form 51degrees.codeplex.com. It's not working.

    Does anyone have a working solution and is willing to share? Thanks in advance.

     

    I (think I) have read all topics about this here, but I cannot find a complete solution in any of them

  • bob baty-barr 1180 posts 1294 karma points MVP
    Dec 18, 2010 @ 22:22
    bob baty-barr
    1

    there was a mobile templage package here somewhere... oh wait... it is on Tim G's site... here...http://www.nibble.be/?p=59

    that shoudl hook you up with everythign you need... you may have to do some updating for v4.5.x -- but i am not sure.

    hope this helps

  • Harm-Jan Abbing 62 posts 102 karma points
    Dec 19, 2010 @ 16:34
    Harm-Jan Abbing
    0

    Here is an example of some simple scripting for mobile detection:

    if ((navigator.userAgent.indexOf('iPhone') != -1) |
    (navigator.userAgent.indexOf('iPod') != -1) ||
    (navigator.userAgent.indexOf('Opera Mini') != -1) ||
    (navigator.userAgent.indexOf('Windows CE') != -1)) {
      document.location = "mobile.site.com";
    }

  • Vincent Baaij 95 posts 344 karma points c-trib
    Dec 20, 2010 @ 09:00
    Vincent Baaij
    0

    @bob: thanks, found that already. That is the part of my solution that does work. The problem I'm having is with the detection of the mobile device.

    @harm-jan: I've tried this and it works. Thanks. I would however like a more sophisticated solution by using the 51 degrees http module. That way I can serve the pages acoording to device specific capabilities.

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Jan 19, 2011 @ 06:10
  • Roger Swearingen 28 posts 49 karma points
    Jan 19, 2011 @ 06:46
    Roger Swearingen
    0

    I've heard that this site has a pretty good mobile browser test:  http://detectmobilebrowser.com/

    They appear to have scripts in just about every language, but I haven't tried any of their scripts.  It also looks like they haven't updated it since june, but could still be okay.

    Please post what you end up doing, as I'm sure many of us are interested.

  • Vincent Baaij 95 posts 344 karma points c-trib
    Jan 19, 2011 @ 09:42
    Vincent Baaij
    0

    @Jason: Yes, I saw that thread. Thanks for mentioning it though. I'm going to use parts of it in the final solution.

     

    @Jeff: Thanks for the link. It is a nice solution, but I don't find it future proof. If a new browser comes along, you have to adapt/aleter the script. The 51degrees solution can pick up the capabilities by just updating the underlying WURFL database.

    I probably end up using the 51degrees solution in combination with the' alttemplate method'. In the web.config I will add the following rules to the 51degrees configuration to redirect users:

    <location name="default" url="http://mysite.com?alttemplate=mobile">
      <add property="url" matchExpression="http://mysite.com"/>
      <add property="IsMobileDevice" matchExpression="true"/>
    </location>
            
    <location name="thetest" url="~/{0}?alttemplate=mobile" matchExpression="(?&lt;=^\w+://.+/).+" >
      <add property="IsMobileDevice" matchExpression="true"/>
    </location>

    You'll need 2 rules because of the default redirect that is taking place on the homepage. If you only add the second rule, visitors of the homepage will be redirected to http://mysite.com/{0}?alttemplate=mobile which is obviously not going to work.

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Jan 19, 2011 @ 18:10
    Jason Prothero
    0

    Vincent,

    I'd love to hear about your final solution.  I'm actually going to try out a few different methods and see what I like best.  I'll post my results back here as well.

    Definitely going to try the alttemplate solution.  I also have a couple of other ideas that may work, but I need to test them first.

     

    Jeff,

    I did see that site.  I also like the 51 degrees better right now, but I may give that a shot.  If you try it, I'd love to hear your thoughts.

     

    -Jason

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 23, 2011 @ 19:00
    Jan Skovgaard
    0

    Hi

    I'm wondering...would it be impossible to use CSS3 media queries to achieve your goal? Then you would not need to worry about redirecting to a mobile version of the site etc. - but be able to adjust the design according to the real estate of the screen on the phone perhaps?

    Off course there can be some specific interaction that justifies that you in fact need a mobile version...

    Just some input that could perhaps be a part of the final solution? :-)

    Cheers

    /Jan

  • James Rosewell 3 posts 71 karma points
    Jan 29, 2011 @ 20:53
    James Rosewell
    0

    Vincent,

    Hello. I'm working on the 51degrees project at Codeplex and would love to help you solve your problem using it with Umbraco.

    Can you tell me a little more about what's happening? Also have you tried the latest version which contains a number of significant enhances for CMS support?

    Our goal has been to ensure the properties provided via the Request.Browser object are accurate therefore avoiding the need to use other workarounds.

    Looking forward to your response.

    James

     

     

  • James Rosewell 3 posts 71 karma points
    Jan 29, 2011 @ 20:54
    James Rosewell
    0

    Vincent,

    Hello. I'm working on the 51degrees project at Codeplex and would love to help you solve your problem using it with Umbraco.

    Can you tell me a little more about what's happening? Also have you tried the latest version which contains a number of significant enhances for CMS support?

    Our goal has been to ensure the properties provided via the Request.Browser object are accurate therefore avoiding the need to use other workarounds.

    Looking forward to your response.

    James

     

     

  • Carlos 338 posts 472 karma points
    Feb 08, 2011 @ 23:12
    Carlos
    0

    Has anyone gotten the 51degrees.mobi stuff to work with using multiple different templates?

    We have 3 different mobile templates for our homepage, internal page and a list page.
    mobile-home, mobile-internal, mobile-details

    All of the doctypes are set up to accept the different alt templates. How do we use 51degrees to direct the doctypes to the different templates.

    We are not using a m.mysite.com URL so we just want the alt templates to work.

    Thanks.

  • Vincent Baaij 95 posts 344 karma points c-trib
    Feb 09, 2011 @ 14:01
    Vincent Baaij
    0

    Carlos,

    You should be able to use something like:

    <location name="default" url="http://mysite.com?alttemplate=mobile-home">
      <add property="url" matchExpression="http://mysite.com"/>
      <add property="IsMobileDevice" matchExpression="true"/>
    </location>
            
    <location name="thetest" url="~/{0}?alttemplate=
    mobile-internal" matchExpression="<expression which catches 'internal page'" >
      <add property="IsMobileDevice" matchExpression="true"/>
    </location>

    <location name="thetest" url="~/{0}?alttemplate=mobile-details" matchExpression="<expression which catches 'list page'" >
      <add property="IsMobileDevice" matchExpression="true"/>
    </location>

     

    If you need an expression to catch all complete url's, use "(?&lt;=^\w+://.+/).+"

     

  • Vincent Baaij 95 posts 344 karma points c-trib
    Feb 09, 2011 @ 14:06
    Vincent Baaij
    0

    @james: I've posted about this on your own forum (link). It's not so much a problem, but I find the solution in which I have to use two loacation elements for the same redirect not very pretty. What happens is that when I visit an umbraco site without a query string (so just the domain), it internally gets redirected to default.aspx (if that is your default document). The solution with your {0} parameter and an umbraco altemplate parameter does not work. More info is on the 51degrees forum.

  • Carlos 338 posts 472 karma points
    Feb 09, 2011 @ 21:50
    Carlos
    0

    @Vincent,

    Your solution did not quite work. I followed your logic for the mobile-page stuff using 'location' and it did not quite work.

    Everything is redirecting to the mobile-listing template. The homepage, the details page, everything, are getting the mobile-listing template, even though the doctypes are set up to accept only certain ones.

    the homepage redirects like this http://mysite.com/{0}?alttemplate=mobile-listing
    Not http://mysite.com?alttemplate=mobile-home

    Any insite?

  • Carlos 338 posts 472 karma points
    Feb 10, 2011 @ 21:27
    Carlos
    0

    @Vincent,

    What does your <redirect> look like?

    Is it anything like this below?

    <redirect  firstRequestOnly="true"
        mobileHomePageUrl="http://mysite.com/mobile"
    timeout="1"
    devicesFile="~/App_Data/Devices.dat"
        mobilePagesRegex="/mobile"
    originalUrlAsQueryString="false"
    >

  • Vincent Baaij 95 posts 344 karma points c-trib
    Feb 11, 2011 @ 12:52
    Vincent Baaij
    0

    Carlos,

     

    This is how my redirect looks:

    <redirect firstRequestOnly="false" mobileHomePageUrl="~/Mobile/default.aspx" timeout="20" devicesFile="~/App_Data/Devices.dat" mobilePagesRegex="/Mobile/">
    The location solution should work. Be sure to check the regular expressions (matchexpression attributes). I frequently use http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx to test them
    BTW are you also 'closdesign' on the 51degrees forum. If so, let's keep the discussion over her, as it is more an Umbraco problem than a 51degrees onee
  • Carlos 338 posts 472 karma points
    Feb 11, 2011 @ 16:47
    Carlos
    0

    @Vincent,

    Yep, closdesign is me on 51degrees. I was just trying to get information where ever I could get it.  Thanks for the reply. I will check it out.

    Thanks.

  • Alex Lopez 8 posts 29 karma points
    Sep 19, 2012 @ 05:11
    Alex Lopez
    0

    Hi all,

    I am working on my first umbraco mobile project and I am interestes on this 51degrees detection and redirecting the user to the alttemplate, I've got multiple templates and I am wondering if someone could post a step list of what to do to make it work, I have downloaded the latest version from codeplex, using umbraco 4.7.2 and visualstudio 2010 .NET4.

    1. Here is what I did, openend the downloaded project "51degrees.mobi_Detection_Sample_2.1.12.2" and publish it to get the Detector.dll and FiftyOne.Foundation.dll then added those to my project.
    2. Copied the config file from 51degrees.mobi_Detection_Sample_2.1.12.2\Detector Web Site\51Degrees.mobi.config to \App_Data
    3. Builded my solution and nothing happens when access it from a mobile device.
    Can you guys please let me know what am I missing an also what's next to do for the multiple templates?
    Thanks
Please Sign in or register to post replies

Write your reply to:

Draft