Auto redirect users to your mobile site!

auto-redirect

Ever wondered how some sites automatically redirect users to a mobile version? It’s quite simple! Let’s explain it a little more clearer. A script will be included in this post!

Considering that most sites are currently using a mobile version and that mobiles are quite a very big part of our daily lives, I believe that a script that automatically redirects users to the designated mobile template is quite useful. Now, you must consider, this is not something that can be implemented directly into a WordPress theme. You can, but first your page must be optimized for usage.

So, let’s get started.  First things are first, the script that does everything.

Download Auto Redirect Script - No Password

Download the script above, and save it in your scripts folder / location. Once you have done this, edit your main file, the one your main page ( index.html / php). Once you have done that, add the following code exactly after importing jQuery, basically, it should be the second line of code in the head scripts section.

<script type="text/javascript" src="scripts/detectmobilebrowser.js"></script>

Once you have added this piece of code, now, save your file to your server, and visit it from your mobile. Once this is completed, your mobile page will redirect to mobile/index.html, but if you wish to change this location, edit the detectmobilebrowser.js and at the end of the script you will locate the code called mobile/index.html. Replace it with the address you require.

That’s all folks! Feel free to use this script in personal or commercial projects.  A link-back would be nice! :)

Hy, I'm Paul. I'm the found of this magazine and a very big fan of sharing out great stuff with you and I'm not referring to warez. If you want to find out more about me, check out my personal page at www.paultrifa.com :) Thanks for reading!

5 Comments on "Auto redirect users to your mobile site!"

  1. Frankie says:

    How do I find a password to download the redirect to mobile site script?

Got something to say? Go for it!

*