V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hpze2000
V2EX  ›  程序员

如何实现, 浏览器点击打开 自己的程序, 类似 迅雷, 91助手等。

  •  
  •   hpze2000 · 2013-11-01 14:55:18 +08:00 · 3626 次点击
    这是一个创建于 3831 天前的主题,其中的信息可能已经有所发展或是发生改变。
    就是一个下载链接, 比如已经安装 了迅雷, 他会至用迅雷打开下载,
    如果没安卓迅雷, 会提示, 先安装迅雷,


    这种功能不知道实现原理是如何的
    14 条回复    1970-01-01 08:00:00 +08:00
    hpze2000
        1
    hpze2000  
    OP
       2013-11-01 15:07:25 +08:00
    问题补充, 如果是 安卓下 又如何实现。。
    Ricepig
        2
    Ricepig  
       2013-11-01 15:09:32 +08:00 via iPhone
    浏览器插件吧
    hpze2000
        3
    hpze2000  
    OP
       2013-11-01 15:11:57 +08:00
    @Ricepig 浏览器插件,不对吧, 我觉得是写入自己的协议,
    但是, 没安装之前, 是如何判断, 提示 要先安装我们的软件 ,这个不懂如何实现。
    inee
        4
    inee  
       2013-11-01 15:12:32 +08:00
    自己写的端口协议
    Ricepig
        5
    Ricepig  
       2013-11-01 15:12:47 +08:00 via iPhone
    @hpze2000 还是插件。。。js判断无法得到插件时就弹窗
    qingting
        6
    qingting  
       2013-11-01 15:12:53 +08:00
    ksky
        7
    ksky  
       2013-11-01 15:13:00 +08:00
    开发的时候可以配置一个短链接,比如weixin://,然后你在浏览器里输入weixin://就可以调出微信了。

    开发App的时候定义的。
    hpze2000
        8
    hpze2000  
    OP
       2013-11-01 15:14:16 +08:00
    @Ricepig 哦这样, 那如果是安卓里面 有没有思路?
    hpze2000
        9
    hpze2000  
    OP
       2013-11-01 15:14:46 +08:00
    @ksky 问题是, 如果还没安装微信呢 ? 这么让他弹出提醒 先安装 微信?
    yangg
        10
    yangg  
       2013-11-01 15:16:16 +08:00
    html5有这个:
    navigator.registerProtocolHandler(protocol, uri, title);
    Note for Chrome:
    Protocol whitelist includes mailto, mms, nntp, rtsp, and webcal. Custom protocols must be prefixed with "web+".
    其它这是我以前看的相关链接
    http://hi.baidu.com/weforhappy/blog/item/43afabc5c0aa23a48326acd1.html
    http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
    http://hublog.hubmed.org/archives/001154.html
    http://updates.html5rocks.com/2011/06/Registering-a-custom-protocol-handler
    http://stackoverflow.com/questions/411544/custom-protocol-in-linux
    hpze2000
        11
    hpze2000  
    OP
       2013-11-01 15:43:12 +08:00
    @yangg 谢谢, 参考下 ,有些 E文 有些吃力
    keniusahdu
        12
    keniusahdu  
       2013-11-01 16:24:53 +08:00
    @hpze2000 Android用Intent。Intent intent= new Intent();
    intent.setAction("android.intent.action.VIEW");
    keniusahdu
        13
    keniusahdu  
       2013-11-01 16:27:25 +08:00
    @hpze2000 Intent intent= new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.setClassName("com.android.browser","启动你的包+Activity");
    startActivity(intent);
    大概是这样。好久不写。记不太清。参考下吧
    darasion
        14
    darasion  
       2013-11-01 17:22:03 +08:00
    就是给浏览器注册一个协议处理程序。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3450 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:54 · PVG 18:54 · LAX 03:54 · JFK 06:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.