Skip to content

Instantly share code, notes, and snippets.

@xgqfrms
Created November 13, 2020 03:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms/9bac17d7ca35b28525bc8839d22420b2 to your computer and use it in GitHub Desktop.
Save xgqfrms/9bac17d7ca35b28525bc8839d22420b2 to your computer and use it in GitHub Desktop.
custom URL scheme / custom URL protocol

custom URL scheme / custom URL protocol

matilto:

<h1>mailto: & E-mail links</h1>

<a href="mailto:support@xgqfrms.xyz">send an email for support</a>

<p>...</p>

<a href="mailto:support@xgqfrms.xyz?cc=name2@rapidtables.com&bcc=name3@rapidtables.com&subject=The%20subject%20of%20the%20email&body=The%20body%20of%20the%20email">
  Send mail with cc, bcc, subject and body
</a>

<p>...</p>

<pre>
  <h3>href="mailto:support@xgqfrms.xyz"</h3>
  https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&source=mailto&to=support@xgqfrms.xyz
</pre>

<p>...</p>

<pre>
 <h3>href="mailto:support@xgqfrms.xyz?cc=name2@rapidtables.com&bcc=name3@rapidtables.com&subject=The%20subject%20of%20the%20email&body=The%20body%20of%20the%20email"</h3>
  https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&source=mailto&cc=name2@rapidtables.com&su=The+subject+of+the+email&to=support@xgqfrms.xyz&bcc=name3@rapidtables.com&body=The+body+of+the+email
</pre>

https://codepen.io/xgqfrms/pen/JjKmbZv

web+xgqfrms

navigator.registerProtocolHandler("web+xgqfrms", "https://www.xgqfrms.xyz?uri=%s", "自定义 URL Scheme");

refs

https://www.cnblogs.com/xgqfrms/p/13966715.html

https://www.cnblogs.com/xgqfrms/p/13965075.html

https://gist.github.com/xyzdata/9e6dee648f4db6fa228f56cba7f69ae8

@xgqfrms
Copy link
Author

xgqfrms commented Nov 13, 2020

URL Scheme

特定 URL 方案

https://github.com/xgqfrms/cdn/tree/gh-pages/URL-Scheme

demo

https://cdn.xgqfrms.xyz/URL-Scheme/index.html

https://cdn.xgqfrms.xyz/URL-Scheme/web+xgqfrms

https://cdn.xgqfrms.xyz/URL-Scheme/web+cdn

"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2020-10-01
 * @modified
 *
 * @description
 * @difficulty Easy Medium Hard
 * @complexity O(n)
 * @augments
 * @example
 * @link
 * @solutions
 *
 * @best_solutions
 *
 */

const log = console.log;

try {
  if(navigator.registerProtocolHandler) {
    // navigator.registerProtocolHandler("web+xgqfrms\/cdn", "https://cdn.xgqfrms.xyz?uri=%s", "自定义 URL Scheme, xgqfrms/cdn");
    // navigator.registerProtocolHandler("web+xgqfrms/cdn", "https://cdn.xgqfrms.xyz?uri=%s", "自定义 URL Scheme, xgqfrms/cdn");
    navigator.registerProtocolHandler("web+xgqfrms", "https://cdn.xgqfrms.xyz?uri=%s", "自定义 URL Scheme, xgqfrms");
    navigator.registerProtocolHandler("web+cdn", "https://cdn.xgqfrms.xyz?uri=%s", "自定义 URL Scheme, cdn");
    log(`navigator.registerProtocolHandler OK ✅`)
  }
} catch (error) {
 log(`navigator.registerProtocolHandler error ❌`, error)
}

@xgqfrms
Copy link
Author

xgqfrms commented Nov 13, 2020

DD link & 钉钉 & URL Scheme

<a href="dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=webgeeker">
     人工智能研发中心-大数据平台部-前端组-凌晨
</a>
<br/>

https://codepen.io/xgqfrms/pen/vYYzjwJ

https://codepen.io/xgqfrms/pen/vYYzjwJ?editors=1010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment