package main
import (
"fmt"
"time"
)
func main() {
for {
fmt.Println(time.Now())
time.Sleep(16 * time.Second)
}
}
go build -o MyApp.exe
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<a href="MyApp://">A</a>
</body>
</html>
注冊表:MyApp.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\MyApp]
@="Open MyApp"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\MyApp\shell]
[HKEY_CLASSES_ROOT\MyApp\shell\open]
[HKEY_CLASSES_ROOT\MyApp\shell\open\command]
@="\"D:\\test\\a\\MyApp.exe\""
從瀏覽器啟動應用程序 - Application URL - Ldlchina - 博客園 https://www.cnblogs.com/ldlchina/p/5045950.html
windows 用瀏覽器打開應用程序的方法_du_peiduo的專欄-CSDN博客_瀏覽器打開應用 https://blog.csdn.net/nothing_is_imposible/article/details/80405361
上面的 reg 文件編寫原理其實就是參照能通過瀏覽器打開的程序的注冊表修改的(比如:迅雷應用程序,win 鍵 + R > 輸入 regedit 在注冊表找到對應程序,導出即可)