jQuery Plugin To Auto Redirect To Mobile or Full WebSite

File Size: 8.46 KB
Views Total: 3576
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Auto Redirect To Mobile or Full WebSite

A tiny jQuery plugin used to detect and redirect mobile users to your separate mobile website.

How to use it:

1. Include jQuery library and the jQuery mobile redirect plugin in your mobile & full website.

<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="src/jquery.mobile-redirect.js"></script>

2. Add cookie support to the plugin.

<script src="jquery.cookie.js"></script>

3. Add a link to the full version of your website.

<a href="#" id="full-site">Switch to full version</a>

4. Call the plugin and specify the paths to the mobile & full websites.

$("#full-site").mobileRedirect({
  mobileUrl: "mobile.html",
  fullUrl: "full.html" 
});

5. Full plugin options.

$("#full-site").mobileRedirect({

mobileUrl: "http://m.example.com",
fullUrl: "http://example.com",
redirectTimeout: 3000,
cookieExpirationDays: 365,
maxMobileWidth: 1024,
maxMobileHeight: 768

});

This awesome jQuery plugin is developed by neonowy. For more Advanced Usages, please check the demo page or visit the official website.