mobile detect redirect

Community Forums Forums Design Tips and Tricks mobile detect redirect

This topic is: not resolved

This topic contains 6 replies, has 3 voices, and was last updated by  CynthiaC 1 year, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41623

    CynthiaC
    Participant
    Post count: 20

    I am using the “News” responsive theme and would like to develop a simple ‘home page’ using the Landing Page feature that will ONLY be the home page when it detects a mobile browser.

    Eg:

    laptop will go to http://www.mywebsite.com

    mobile device is automatically redirected to http://www.mywebsite.com/mobilehome/

    I have found different suggestions on the interweb but rather than muck up some perfectly good code I thought there might be a tried and tested Genesis Fix.

    Thank you

    • This topic was modified 1 year, 3 months ago by  CynthiaC.
    • This topic was modified 1 year, 3 months ago by  CynthiaC.
    #41643

    Anita
    Participant
    Post count: 7409

    The problem you may have is that you can define a screen size for the laptop in the media queries, however if other mobile devices are the same size – they too will be taken to that page. Do you want a particular sized device to show that new page?


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #41648

    CynthiaC
    Participant
    Post count: 20

    I would say it would  be most useful/practicable for the iphone/android or mini ipad.  Everything else would be just fine using the regular home page.

     

    #41721

    Anita
    Participant
    Post count: 7409

    Okay. Each theme developer codes media queries differently and some add all of them, while some only add a few. It is impossible to really anticipate all mobile devices but they do their best to code for the common ones. For example, some themes have issues with different browser version. The same with mobile devices – they come out with so many so quickly that there’s no way to keep up. So… the best thing to do is just try to come as close as reasonably possible.

    Brian Gardner wrote this Introduction to Media Queries. Read this and maybe you might see some type of mobile query that fits what you are looking for. Then copy paste it under your media queries and then add the styles in there.

    http://www.briangardner.com/media-queries/


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #41733

    CynthiaC
    Participant
    Post count: 20

    That doesn’t quite address the redirect issue.

    I would like the website to automatically redirect to a different home page when it detects a mobile device.

    Script would be something like this – but hoped for something to put in the function.php file instead?

    <script type=”text/javascript”>
    $(document).ready(function(){
    if($(window).width() < 600){
    window.location.href = “http://mywebsite.com/mobilehome/”
    }
    });
    </script>

    #41747

    Bill Murray
    Participant
    Post count: 575

    @CynthiaC – I think you understand you can’t do this with media queries/responsive design.

    If you want to redirect mobile users to 1 page, the fastest way to do it would be via UA detection or MIME-type support (such as a check for WML) followed by redirection in your htaccess file (assuming your site is on an Apache server). These methods aren’t 100% foolproof, but they are pretty reliable. Your script solution would be another route (you could use Genesis settings to get that into the head of your document). There are also open source PHP libraries, like php-mobile-detect. I think the htaccess route would be the fastest.

    While you can do what you want, you might want to pause and ask yourself whether you should do what you want. From an SEO perspective, what you want to do isn’t a great SEO strategy. More info here.

    Hope that helps.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #41857

    CynthiaC
    Participant
    Post count: 20

    Thanks to both of you,

    Lots of food for thought.

    I guess I will set up an ‘experimental’ site and see what I can come up with.

     

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.