如何在chrome中设置自定义协议处理程序?就像是:
myprotocol:// testfile的
我需要将此请求发送到http://example.com?query=testfile,然后将httpresponse发送到我的扩展程序.
我试图检测我的应用程序处理自定义协议是否已安装并使用不同的浏览器工作.我在本网站上查看了其他问题,例如: 如何检测浏览器的协议处理程序?,并查看了这样的资源,使其适用于大多数浏览器中的大多数平台.
在将此标记为重复之前,请听我说...
除了Windows 8+上的Chrome之外,我能够使用我的功能.我无法像在Windows 7上那样在Chrome上使用窗口焦点方法,因为它会弹出要求我在商店中查找应用的消息.
是否有任何方法(没有扩展名)来检测Chrome上的Windows 8+中的自定义协议处理程序?
更新:
使用onBlur来检测它只适用于Windows 7,因为在8+中,如果它没有找到打开你的协议的东西,它会打开"从应用程序商店找到一些东西"对话框,使浏览器失去焦点.
javascript google-chrome protocols custom-protocol windows-8
我正在考虑将应用程序注册到URL协议,我想知道,方案中允许哪些字符?
一些例子:
h323:[<user>@]<host>[:<port>][;<parameters>]
.
)
z39.50r://<host>[:<port>]/<database>?<docid>[;esn=<elementset>][;rs=<recordsyntax>]
:
)
paparazzi:http:[//<host>[:[<port>][<transport>]]/
那么,我可以使用哪些角色?
我们可以......
@:TwitterUser
#:HashTag
$:CapitalStock
?:ID-10T
......等等,或者方案中的字符受标准限制?
standards-compliance url-scheme custom-protocol illegal-characters
我试图将我的一个爱好项目移植到linux.最好是Mono,因为它是用C#编写的.但我也在研究Python.
该应用程序的一个功能是它需要与自定义协议关联,以便当用户在应用程序的网站上单击此类链接时调用应用程序:
myapp://module/action
Run Code Online (Sandbox Code Playgroud)
怎么能在linux/unix系统中完成?我可以像Windows一样关联系统范围的处理程序吗?还是需要依赖浏览器?
在Google上找不到任何内容.我对linux编程完全无能为力.
我需要一些指示.谢谢!
我想打开app并使用Electron(macOS)通过深度链接传递参数.
项目'electron-deep-linking-mac-win'在GitHub上.
编辑package.json
,按照'电子生成器'快速设置指南生成mac安装程序:
{
"name": "electron-deep-linking-osx",
"version": "1.0.0",
"description": "A minimal Electron application with Deep Linking (OSX)",
"main": "main.js",
"scripts": {
"start": "electron .",
"pack": "build --dir",
"dist": "build"
},
"repository": "https://github.com/oikonomopo/electron-deep-linking-osx",
"keywords": [
"Electron",
"osx",
"deep-linking"
],
"author": "GitHub",
"license": "CC0-1.0",
"devDependencies": {
"electron": "1.6.6",
"electron-builder": "17.1.2"
},
"build": {
"appId": "your.id",
"mac": {
"category": "your.app.category.type"
},
"protocols": {
"name": "myApp",
"schemes": ["myApp"]
}
}
}
Run Code Online (Sandbox Code Playgroud)
编辑main.js
,附加代码注册myapp
url方案协议,监听'open-url'事件 …
macos custom-protocol electron custom-url-protocol electron-builder
我有一个自定义url协议处理程序,用于myhandler:// path/to/something形式的url.这是注册到本地安装的客户端应用程序,它处理请求并执行"正确的操作".
但是,当我在outlook(2007)中找到该表单的链接时,outlook会显示一个可怕的警告:
微软办公室发现了潜在的安全问题
这个位置可能不安全......
超链接可能对您的计算机和数据有害.要保护您的计算机,请仅单击来自可信来源的超链接.
你想继续吗?
我知道outlook注册表项可以让我完全禁用这些警告(http://support.microsoft.com/?kbid=925757),但我不想成为机器上的"坏公民" .
有没有办法让我可以"白名单"我的url协议处理程序,以表明我已经完成了应有的安全勤勉,而没有打开对机器上其他URL协议处理程序的访问权限,这些处理程序可能无法加强恶意用户输入?
Outlook不会提示表单的URL http:
https:
mailto:
(也可能是其他URL ).这个列表是硬编码在办公室深处的某个地方还是有某种方法可以将我的特定协议添加到列表中?
是否有任何开源,高级工具可以使用GUI促进和简化实验网络协议(TCP/UDP)的开发?
基本上,像动态状态机编辑器,可以让你定义"数据包","消息","状态","验证器","处理程序"等.
优选地,这样的工具将足够全面以处理协议的所有相关方面(即客户端和服务器),以便高级协议描述可以被序列化为XML/RDF文件,其中它可以用于动态创建用于实现协议的应用程序代码(即在Python中).
user-interface state protocols network-protocols custom-protocol
$(function () {
$("div[href]").click(function (event) {
debugger;
//for validation purpose.
window.location = "abcd:";
//if it is validated then
window.location ="xyz:";
});
});
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Custom Protocol Detection</title>
</head>
<body id="abcd">
<h1>Click one of these labels:</h1>
<a href="#" id="atemp"></a>
<div href="blahblah:randomstuff" style="background-color:aquamarine">
Non-exist protocol
</div>
<div href="mailto:johndoe@somewhere.com" style="background-color:aqua">
Send email
</div>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="example.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我如何以及在何处使用navigator.registerProtocolHandler使其工作?
.
本主题建议您可以调用以下函数来添加自定义协议处理程序:
navigator.registerProtocolHandler('web+custom', 'http://example.com/rph?q=%s', 'My App');
Run Code Online (Sandbox Code Playgroud)
当我从控制台调用它时,我得到了
Uncaught DOMException: Failed to execute 'registerProtocolHandler' on 'Navigator':
Can only register custom handler in the document's origin.
Run Code Online (Sandbox Code Playgroud)
如果我将其作为此处建议的内容脚本的一部分包含在内,也会发生这种情况
install_protocol.html
<head>
<title>Web Protocol Handler Sample - Register</title>
<script type="text/javascript">
navigator.registerProtocolHandler("burger",
"http://www.google.co.uk/?uri=%s",
"Burger handler");
</script>
</head>
Run Code Online (Sandbox Code Playgroud)
我也尝试在我的background.js脚本中调用它,它没有给出错误,但协议似乎没有响应.
.
你能解释一下如何在Chrome中注册和使用自定义协议吗?
我一直在尝试在haskell中实现协议解析器,我对这种语言很陌生,特别是在涉及monad时.我一直在使用binary-0.5.0.2并描述了我的协议的头部和所有有效载荷.我要解析的消息类似于以下内容:header +(有效负载A,有效负载B,..)其中标头中的字段指定消息具有哪种类型的有效负载.
我已经成功解析了bytestring中的第一条消息,但是对于如何阅读下一条消息感到不知所措,丢弃了在处理第一条消息时读取的字节.
这可能是相当模糊的,但我宁愿得到一个通用解析器的输入,而不是让我的丑陋代码改变为以这种方式工作.
谢谢您的帮助
custom-protocol ×10
javascript ×3
protocols ×3
binary ×1
electron ×1
haskell ×1
html ×1
linux ×1
macos ×1
ms-office ×1
state ×1
url-scheme ×1
windows-8 ×1