阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      插件 jQuery.iOS App Switcher 中文API文档

      插件 jQuery.iOS App Switcher 中文API文档 https://github.com/rscherf/Switcher

      Switcher

      A jQuery plugin that converts regular links to iOS app URL schemes so your visitors can visit your social profiles in native apps.

      Converts HTML href attributes like: http://twitter.com/ryanscherf to twitter://user?screen_name=ryanscherf

      Written by Ryan Scherf : http://ryan.sc - http://twitter.com/ryanscherf

      In Action

      Visit http://ryan.sc on your iOS device and tap either Twitter or LinkedIn.

      Requirements

      Originally written with jQuery 2.X, but is probably backwards compatible.

      Script is only enabled on iOS devices (iPhone, iPod and iPad) based on browser userAgent.

      Usage

      Markup your social profile links:

      <div class="social">
        <a href="http://twitter.com/ryanscherf">@ryanscherf</a>
      </div>
      

      Target them with a single jQuery selector:

      $(".social a").switcher();
      

      OR

      Some apps (liked LinkedIn) require an id to access, and not the pretty username.

      <a class="linkedin" href="http://linkedin.com/ryanscherf" data-username="10998304">
        @ryanscherf on LinkedIn
      </a>
      

      Switcher will scan all the links in the set and determine if any can be deeplinked to native apps. If a username can’t be found in data-username attribute, Switcher will attempt to derive it from the URL.

      If the native iOS app isn’t installed, Switcher will load the link as expected.

      Options/Settings

      OptionDefaultDescription
      debugfalseConverts links on non-iOS devices for testing
      iOSiPhone, iPod, iPadDefines the navigator.userAgent to look for on iOS
      additionalSchemas[]An array of patterns and schemes for additional native apps

      Contribute

      I don’t use every app, so I didn’t include all the app URL schemes available to the world. Want to add more? Do it.

      1. Fork/clone the repository
      2. Add whatever you’d like
      3. Submit a Pull Request
      1. Star the Github repository
      2. Follow http://twitter.com/ryanscherf on Twitter and tell me how much you love this plugin
      3. Use it however you’d like
      目录
      目录