基于François-Xavier De Nys的上述回答
支持通话和聊天链接。
将echo123替换为您的 Skype ID。
脚本:
<script src="https://secure.skypeassets.com/i/scom/js/skype-uri.js"></script>
<script>
// code for adding and clicking hidden Skype buttons
var
SkypeButtons_ek = {},
// call when doc ready to setup the hidden button
// id = any unique id, user = your skype user id, type = call or chat
SkypeButton_ek_add = function(id, user, type){
SkypeButtons_ek[id] = {user: user, type: type};
jQuery("body").append('<div id="SkypeButton_ek_'+id+'"></div>');
Skype.ui({
"name": type,
"element": "SkypeButton_ek_"+id,
"participants": [user]
});
jQuery("#SkypeButton_ek_"+id+", #SkypeButton_ek_"+id+" > iframe").hide();
},
// call from your own link/button/event
// id is the same id you passed to SkypeButton_ek_add
SkypeButton_ek_click = function(id){
if (SkypeButtons_ek[id].type == 'chat')
SkypeWebControl.SDK.Chat.startChat({ConversationType: 'person', ConversationId: SkypeButtons_ek[id].user});
else {
Skype.tryAnalyzeSkypeUri(SkypeButtons_ek[id].type, '0');
Skype.trySkypeUri_Generic('skype:'+SkypeButtons_ek[id].user+'?'+SkypeButtons_ek[id].type+'', jQuery('#SkypeButton_ek_'+id+' > iframe').attr('id'), '0');
}
};
// add Skype buttons hidden
jQuery(document).ready(function($){
SkypeButton_ek_add(1, 'echo123', 'chat');
SkypeButton_ek_add(2, 'echo123', 'call');
});
</script>
标记
<a href="" onclick="SkypeButton_ek_click(1); return false;">Skype Chat</a>
<a href="" onclick="SkypeButton_ek_click(2); return false;">Skype Call</a>
您当然可以将SkypeButton_ek_click
调用添加或绑定到任何事件。