zoukankan      html  css  js  c++  java
  • PC网页js调用本地应用程序

    最近要现实一个在PC网页中实现点击按钮调用本地应用程序的功能

    其实实现原理也非常简单,

    首先注册一个本地注册表文件,指向本地应用程序路径

    其次在网页中用js指向这个注册表文件,就可以实现网页调用本地应用程序 

    Windows Registry Editor Version 5.00
    
    
    
    [HKEY_CLASSES_ROOTmyprotocol]
    
    @="myprotocol Protocol"
    
    "URL Protocol"=""
    
    
    
    [HKEY_CLASSES_ROOTmyprotocolDefaultIcon]
    
    @="D:\Tools\FF\tencent\qqmusic\QQMusic.exe"
    
    
    
    [HKEY_CLASSES_ROOTmyprotocolshell]
    
    @=""
    
    
    
    [HKEY_CLASSES_ROOTmyprotocolshellopen]
    
    @=""
    
    
    
    [HKEY_CLASSES_ROOTmyprotocolshellopencommand]
    
    @=""D:\Tools\FF\tencent\qqmusic\QQMusic.exe" "
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body style="text-align: center;padding-top: 300px;">
    <button onclick="window.location.href='myprotocol://D:\work\data\2018\08-11\11-16\myprotocol.reg'" style="margin: 200px auto;">打开QQ音乐</button>
    <a href="myprotocol://D:workdata20188-1111-16myprotocol.reg" style="margin: 200px auto;">打开QQ音乐</a>
    </body>
    </html>

  • 相关阅读:
    input 放大镜
    记住密码弹出事件
    thinkphp修改及编写标签库,编辑器的使用
    thinkphp 配合mongodb
    缓存技术
    php面试题目
    pdo 整套类的封装,保存修改查询
    mongodb 的备份恢复导入与导出
    mongodb 分组查询
    smarty 模板的入门使用
  • 原文地址:https://www.cnblogs.com/zhixi/p/9969219.html
Copyright © 2011-2022 走看看