脚本宝典收集整理的这篇文章主要介绍了php – 发送多个应用程序协议请求(类似于mailto:),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
但是,我需要创建一个PHP或javascript(或组合)来基本上尽快向协议发送3个请求.如果最终结果是www.test.com/send.PHP,我也想要用户链接< a href ='www.test.com / send.PHP'>不会弹出或重定向到页面很像做
<?PHP header('Location:msnim:chat?contact=test@test.com'); ?>用户点击href时不会创建新页面或重定向 这是我的概念验证的jqUERY和JSBin http://jsbin.com/etubas/11/
$(document).ready(function(){ $("a#click_me").click(function(){ setTimeout(function(){ console.LOG('test ran'); window.location = 'mailto:test@test.com'; },100); setTimeout(function(){ console.log('new ran'); window.location = 'mailto:new@new.com'; },200); }); });
这似乎适用于IE9,据我所知IE8. Firefox 10似乎也可以,但Chrome 17只能发送第一封电子邮件.
编辑1:更新了MSN而不是AIM链接,以便更加通用于测试,并包括jquery示例和JSbin
编辑2:更新到mailto链接
<html> <head> <script tyPE="text/javascript"> $(document).ready(function(){ VAR imURL = 'http://josh.gITlin.name/9472703.PHP?id='; // Change this to your URL function openIM(who) { var iFrame = '<iframe src="'+imURL+who+'"></iframe>'; $('div#imLinks').append(iFrame); } $("a#click_me").click(function(e){ e.preventDefault(); setTimeout(function(){ openIM('1'); },100); setTimeout(function(){ openIM('2'); },200); }); }); </script> </head> <body> <p>Some content here</p> <p><a href="#" id="click_me">Click Me!</a></p> <div id="imLinks"></div> </body> </html>
<?PHP $screenname = ''; switch($_REQUEST['id']) { case '1': $screenname = 'FirstPerson'; break; case '2': $screenname = 'secondPerson'; break; default: $screenname = 'otherPerson'; break; } echo <<<END_OF_HTML <html> <head> <Meta http-equiv="refresh" content="0;url=aim:goim?screenname=$screenname"> </head> </html> END_OF_HTML;
Tested under Safari and Chrome,这将在单击链接时打开多个IM窗口.显然调整到令你满意.
以上是脚本宝典为你收集整理的php – 发送多个应用程序协议请求(类似于mailto:)全部内容,希望文章能够帮你解决php – 发送多个应用程序协议请求(类似于mailto:)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。