插件 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

Option Default Description
debug false Converts links on non-iOS devices for testing
iOS iPhone, iPod, iPad Defines 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

AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

于2021年离开前端领域,目前重心放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>

于2021年离开前端领域,目前从事区块链方面工作了