jQuery Plugin To Convert Regular URLs Into iOS URL Schemes - Switcher

File Size: 5.9 KB
Views Total: 1038
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Convert Regular URLs Into iOS URL Schemes - Switcher

Switcher is a jQuery plugin used to convert regular social profile URLs to iOS app URL schemes so the visitors can visit your social profiles in native apps. Currently supports Facebook, Twitter, Instagram, Linkedin, and Quirky. You can also add custom patterns and schemes via additionalSchemas options for additional native apps.

How to use it.

1. Include jQuery library and the jQuery Switcher plugin in the document.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="source/jquery.switcher.js"></script>

2. Wrap your social profile links into a container.

<div class="demo">
  <a href="https://twitter.com/jqueryscript">Twitter</a>
  <a href="http://www.facebook.com/jqueryscript">Facebook</a>
</div>

3. Call the plugin.

$(document).ready(function() {
  $(".demo a").switcher();
});

4. This will convert your social profile links into:

<div class="demo">
  <a href="twitter://user?screen_name=jquery">Twitter</a>
  <a href="fb://profile/428802613841578">Facebook</a>
</div>

5. Options available.

additionalSchemas : [], // An array of patterns and schemes for additional native apps
debug : false, // Converts links on non-iOS devices for testing
iOS   : /(iPad|iPhone|iPod)/g.test(navigator.userAgent) // Defines the navigator.userAgent to look for on iOS

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