Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    925
    Thanks
    76
    Thanked 29 Times in 29 Posts

    Detect device with jQuery

    Good afternoon,

    I am wanting to make my website responsive and I'm doing it to my live website.

    How can I detect whether a user is on a mobile device as I am going to redirect them to a very simple splash page I made.

    Kind regards,
    LC.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,691
    Thanks
    25
    Thanked 656 Times in 655 Posts
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,460
    Thanks
    11
    Thanked 600 Times in 580 Posts
    don't redirect mobile devices, which will soon be the majority of users. use responsive design to deliver a good experience to everyone who lands on your site. it would be better to redirect desktop users as they would be less put-off because bandwidth and performance is much better on a desktop, so they don't have to wait as long on the re-direct...
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • #4
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    925
    Thanks
    76
    Thanked 29 Times in 29 Posts
    Good evening all,

    This is only a temporary thing and once I've completed the responsiveness I'm going to remove all the code. Because it is only temporary is it not best to just redirect mobile users to the temporary page until I've completed the website.

    I've created the page which I want to redirect them to, it's literally my logo with 'Coming soon to a mobile near you!' underneath. The only links go to my social media and email atm.

    I have researched it online and haven't found anything concrete or recent. Just wanted to know what the proper way to redirect a user depending on device. I'm pretty sure jQuery/JavaScript should suffice as I've seen some PHP methods.

    Kind regards,
    LC

  • #5
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,436
    Thanks
    11
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by LearningCoder View Post
    This is only a temporary thing and once I've completed the responsiveness I'm going to remove all the code. Because it is only temporary is it not best to just redirect mobile users to the temporary page until I've completed the website.
    Not really. "Under Construction" was a fad of the '90's, and really isn't the way it's done anymore. You should leave the old site up until the new one is done, then just replace it.

    Quote Originally Posted by LearningCoder View Post
    I have researched it online and haven't found anything concrete or recent. Just wanted to know what the proper way to redirect a user depending on device. I'm pretty sure jQuery/JavaScript should suffice as I've seen some PHP methods.
    It's not particularly easy, and not recommended. The way to do this would be to check the user agent string with JS or PHP, and look for any device name you consider "mobile", then redirect those to your splash page. By the time you get that all done, you'll be so pissed off that you'll wish you'd just waited to get your responsive page done.


  •  

    Posting Permissions

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