Windows 8.1/IE11自定义URL协议打开到-->;关于:空白
Windows 8.1/IE 11自定义url协议混乱。启动时,执行应用程序,然后浏览器中的url重定向到about:blank 甚至Skype的协议也能做到:Windows 8.1/IE11自定义URL协议打开到-->;关于:空白,windows,windows-8.1,internet-explorer-11,url-protocol,Windows,Windows 8.1,Internet Explorer 11,Url Protocol,Windows 8.1/IE 11自定义url协议混乱。启动时,执行应用程序,然后浏览器中的url重定向到about:blank 甚至Skype的协议也能做到: <a href="skype:_some_skype_account_here_?chat">Chat via Skype</a> 我尝试过几种方法,比如使用iframes,document.location.href=u;结果很差 当链接位于iframe内部时,此选项似乎有效,否则将失败: <a
<a href="skype:_some_skype_account_here_?chat">Chat via Skype</a>
我尝试过几种方法,比如使用iframes,document.location.href=u;结果很差
当链接位于iframe内部时,此选项似乎有效,否则将失败:
<a href="javascript:'x();'>test</a>
document.location.href = 'proto://datadatadata';
document.location.href=proto://datadatadata';
有人知道如何在浏览器不重定向到about:blank的情况下启动协议的应用程序吗
我现在将IE11视为一个完全不同的浏览器:chrome、FF、safari、IE7-10和IE11此版本似乎正在运行:
var iframe = document.createElement('IFRAME');
iframe.setAttribute('id' 'protoIframe');
iframe.setAttribute('src', 'myapp://datadatadata' );
iframe.style.display = 'none';
iframe.style.width = 1+'px';
iframe.style.height = 1+'px';
document.documentElement.appendChild(iframe);
更新:(几个月后) 这是我用于IE的最终版本。我检测到浏览器,如果IE检测到,则:
var hst = { pad:'--eof--'}
hst.forIE = function(service, data) {
var f = document.getElementById('ecPrinterIframe')
if (f )
f.parentNode.removeChild(f);
var iframe = document.createElement('IFRAME');
iframe.setAttribute('id', 'ecPrinterIframe');
iframe.setAttribute('src', 'myproto://' + data + hst.pad );
iframe.style.display = 'none';
iframe.style.width = 1+'px';
iframe.style.height = 1+'px';
document.documentElement.appendChild(iframe);
}
嗯,我在IE11+Win7SP1中运行自定义URL协议也有问题。当我在IE 11+Win 8.1中运行它时,它运行得很好。在其他系统上也是如此。我觉得很奇怪。我将尝试这个解决方案。@swdev我刚刚用我在生产中使用的版本更新了这篇文章。这是在IE11 Win 7中工作的--我只是仔细检查了一下。希望这对你也有用。我正在调用一个js函数,该函数将上述函数调用为:flanger。我会试试看!我还在将Win7更新为SP1并安装IE11的过程中,现在我正在读这篇文章:你也读过吗?似乎我真的必须像你一样做客户端解决方案。更新:只需使用你的解决方案解决这个问题。在我的特殊情况下,我的自定义URL协议非常长(超过535个字符,IE允许的最大长度——我自己测试过)。将常规超链接移动到创建
iframe
的javascript中后,它就可以工作了!谢谢@Brian!