LoginSignup
2
2

More than 3 years have passed since last update.

URLスキーム経由でローカルプログラムを実行する

Last updated at Posted at 2019-06-08

はじめに

HTML の リンクをクリックするとローカルPC内のアプリを実行する方法です。

カメラの起動の例

camera.html
<!DOC TYPE HTML>
<html>
<body>
    <a href="microsoft.windows.camera:">カメラを起動</a>
</body>
</html>

任意のアプリを実行可能にする

レジストリの設定

下記記述の凡例

  • 【キー】
  • 「値」
設定内容
HKEY_CLASSES_ROOT
└【{任意の名前}】
  ├「(規定)」URL:{任意の名前}
  ├「URL Protocol」
  └【shell】
    └【open】
      └【command】
        └「(規定)」{実行したいファイルパス}
HKEY_CLASSES_ROOT
└【Qiita】
  ├「(規定)」URL:qiita-test
  ├「URL Protocol」
  └【shell】
    └【open】
      └【command】
        └「(規定)」d:\temp\test.bat

HTML の記載

qiita_test.html
<!DOC TYPE HTML>
<html>
<body>
    <a href="qiita-test:">独自キーのアプリを起動</a>
</body>
</html>

おわりに

メモしていたのものを掘り起こしただけの覚書なので、有意性をあまり分かってないで書いています。
知見のある人からフォロー頂ければ嬉しいです。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2