2

My webpage doesn't work for mobile devices, so I want to disable mobile access, at least for now. Is there a jQuery/javascript script to disable access to a website for smartphones and mobile devices? Could it be redirected to a small 404 page (or similar) that I will setup saying that you have to visit the website on a computer? In addition, do you have any good references on designing a site for mobile access?

RoboticRenaissance
  • 845
  • 1
  • 10
  • 15
Shad Asinger
  • 102
  • 1
  • 6

4 Answers4

6

Detect Mobile Browsers provides various open source mobile phone detection scripts (including JavaScript and jQuery) which you may find useful.

To use it:

"Download a mobile browser redirect script and change http://detectmobilebrowser.com/mobile to your mobile site's URL."

jleft
  • 3,409
  • 1
  • 21
  • 35
3

What you probably want is a server side process that determines what device the user has and that redirect him to the correct site. We use Wurlf to do the device detection. It has API's for Java and PHP so you can query it and redirect accordingly.It also gives you a ton of device capabilities on the server side. http://wurfl.sourceforge.net/.

If you want a client side detection I suggest you use modernizr: http://modernizr.com/

What you do not want to do is block access. It's better to have something rather than nothing.

Koen Peters
  • 12,448
  • 6
  • 34
  • 57
  • Nice... could use. Was actually looking for a basic JS than a PHP, Its just that I am not experienced in PHP for customization :) – Shad Asinger Apr 16 '12 at 16:12
1

You can do a bit of Googling to get an idea of what you need to do, actually. But do take note that this is a lot like browser sniffing, which is generally a Bad Thing™.

Community
  • 1
  • 1
Richard Neil Ilagan
  • 14,133
  • 5
  • 44
  • 64
1

Don't block the site, just put a notice in top that the site is not (yet?) optimized for smartphones, so if something is not working they should use a computer.

Matsemann
  • 18,825
  • 18
  • 54
  • 88