0

I am not sure if this is possible or maybe I am just doing it the wrong way. What I want to do is to call a function which checks the database to get the skype id (user B) and verify if user A is login. If user A is login and a Skype ID for user B is found then start up Skype. If not, nothing happens. Sounds simple enough....

A function is called when a user (user A) click on an image button on a form.

For example on start.html

<a href="#" onclick="skypeme('var1','var2'); return false"><img src="images/chat.png" ></a>

skypeme is a javascript function like this:

<script>
function skypeme(a,b) {
    window.location = 'skypeme.cfm?a=' + a + '&b=' + b;
    }
</script>

which calls skypeme.cfm to do all the database checking:

check the database and see if user A is login.... 
if user A is login, check if user B has skype ID
       if skype id is found for user B do this
           <script language="javascript">
           window.location = 'skype:#skype_id#?chat';
           </script>
       else do nothing 
else user A is not login
    <script language="javascript">
    signin('#a#','#b#');
    </script>

The skypeme.cfm is doing its job and start up Skype when everything is checked out fine. However, the problem is when user click on the button on start.html, he is directed to a blank page skypeme.cfm (skypeme.cfm doesn't display anything but checking) then the skype starts.

Is there any way to do it so that when the user click on the chat button on start.html, he will REMAIN on the start.html page while skype.cfm check the database and kick up Skype with javascript code? This maybe something simple but I just can't get it to do that. Any help is appreciated. Thanks in advance.

Jack
  • 73
  • 8
  • 1
    You want to use an Ajax request to skypeme.cfm, and only do the relocate once that request has completed succesfully – duncan Mar 28 '15 at 10:31
  • Your question shows a window.location in skypeme.cfm. Does that not do what you want? Plus, a simpler approach would involve much less js. Why not have a normal anchor tag to the coldfusion page from the html page? – Dan Bracuk Mar 28 '15 at 15:24
  • @duncan how do you do that? Besides, I really don't want the user to be redirect to "relocate", but stay on start.html page and fire up Skype. – Jack Mar 28 '15 at 19:06
  • @DanBracuk skypeme.cfm does the job of firing up Skype. But the user is directed when skypeme is called. I don't want the user to be re-directed. An anchor tag will also redirect the user to skypeme.cfm which I don't want. skypeme is simply for checking the database and firing up skype. The user should be staying on the start.html page and skypeme running at the background. BTW, I also tried turning skypeme into cffunction but obviously I can't do the javascript firing up skype inside the cffunction. – Jack Mar 28 '15 at 19:09
  • I googled and found this: http://stackoverflow.com/questions/2841676/how-to-start-skype-chat-not-call-with-link Maybe it will help you. – Alejandro Teixeira Muñoz Apr 12 '15 at 18:53
  • @AlejandroTeixeiraMuñoz That was not the issue. I can't use href here. I need to pass the two parameters to the skypeme.cfm program to check if the user A is login first and if an skype id for user B is found then launch it. – Jack Apr 14 '15 at 03:45

2 Answers2

0

Use to redirect to the link

window.location = 'skype:' + phone + '?call';
0

Instead of pointing window.location to skypeme.cfm, load it inside an iframe (you can either dynamically attach an iframe to the document or just change it's src). Redirecting the iframe to a skype: uri works just as fine.

Maxim Krizhanovsky
  • 26,265
  • 5
  • 59
  • 89