2

I know to open skype using its special commands in html to chat, for example:

<a href="skype:some_skype_user?chat">Chat</a>

One can click on "Chat" and it will launch Skype if it is installed.

However, I want to check if a customer is login to OUR SITE before he is able to chat. Once the person is login, I would like to launch Skype with a Javascript function so that he does not have to click on the "Chat" link to start Skype. So basically launching skype:some_skype_user?chat automatically. It must be something simple, but I can't seem to find any answer. Thanks in advance.

Jack
  • 853
  • 1
  • 7
  • 20

1 Answers1

4

Try 'redirecting' to the 'link':

window.location = 'skype:some_skype_user?chat';

Edit: To use a variable in place of some_skype_user you need to concatenate it:

var skypename = 'skypeuser01';
window.location = 'skype:' + skypename + '?chat';
Neaox
  • 1,933
  • 3
  • 18
  • 29
  • how do I use a variable in place of some_skype_user in Javascript? – Jack Mar 23 '15 at 02:01
  • See the edit above, if you don't know how to concatenate strings in JavaScript (a basic concept) I recommend that you look up the basics as these fundamentals are used heavily when coding. I recommend trying out a codecademy course to help show you the ropes: http://www.codecademy.com/en/tracks/javascript – Neaox Mar 23 '15 at 02:08
  • Thanks. I will definitely do that. I am trying to pass the variable as to a function such as: _function myfunction(skypevalue) { var skypevalue; window.location = 'skype:' + skypevalue + '?chat'; }_ But it is not working properly – Jack Mar 23 '15 at 02:19
  • Remove the `var skypevalue;` as this is reinitializing the variable and overwriting the parameter value. – Neaox Mar 23 '15 at 02:46
  • Thanks for this. It is working. However, I need to check if the user is log in then launch it. I am now trying to do like this http://stackoverflow.com/questions/29312669/how-to-launch-skype-without-being-redirected-by-window-location-in-javascript but it is forwarding me to the blank page then launch Skype. Do you know how to do it so it won't forward the user to the blank page? – Jack Apr 12 '15 at 18:53