1

I would like to allow some users to be able to launch a voip application from a web page, ie in response to clicking a button to dial the telephone number for the record they are looking at.

My question is can i use greasemonkey to launch the exe and pass a parameter from the a webpage or will security restrictions stop this from working.

Ive never used greasemonkey before, but is this feature would make it worth my while hacking it a little.

  • That's not posible. Otherwise someone will run `rm -rf /` after you click the link on specially prepeared page. – Ivan Nevostruev Nov 18 '09 at 23:19
  • @Ivan: greasemonkey does not run remote code, unless told to from the user who installs scripts; nonetheless, it's not possible to run an external application. – Patonza Nov 18 '09 at 23:21

3 Answers3

1

I don't think you can do that with greasemonkey.

You can setup a handler for certain file types. When Firefox encounters one of those types, it will launch the application associated with the type. You can create a script that returns the phone number and mime type header of text/voip. Have a wrapper application open the file and pass the parameters to the voip app.

This will require your users to install your voip wrapper program. The installer for the voip wrapper should associate itself with text/voip mime types.

How to associate mime types on windows.

Thats how I'd do it.

edit

In PHP the server side code for this might look like

<?
header("Content-Type: text/voip\n");
echo $_REQUEST['phone'];
?>

You would call it like:

<a href="callPhone.php?phone=555-555-5555">Call this number!</a>

it would contain

Content-Type: text/voip (This would only be in the header, you would never see this in the file)
555-555-5555
Byron Whitlock
  • 52,691
  • 28
  • 123
  • 168
  • I like this thinking, but how would i create the voip file, would that have to be done with server side scripting? –  Nov 18 '09 at 23:29
  • yeah it should be very very simple. When you are listing phone numbers include a link to callApp.php?phone=555-555-5555. callApp.php would set the mime type of text/voip and serve the page with just the phone number text in it. Your wrapper would need to be associated this mime type. The mime type association uses the same mechanism as a file extension association. – Byron Whitlock Nov 19 '09 at 00:01
  • Here is a link for associating mime types on windows. http://msdn.microsoft.com/en-us/library/aa266423(VS.60).aspx – Byron Whitlock Nov 19 '09 at 00:02
  • Can you give me an example of the html for a link that is specified as mime type text/voip? IE What it should look like, just a snippet –  Nov 19 '09 at 00:24
0

No, you can't launch an external application from greasemonkey.

For that, you would need a browser plugin.

Patonza
  • 6,557
  • 5
  • 25
  • 20
  • Well, Firefox extensions can also launch external applications. They can also register their own components (i.e. they can do what the external application would have done). – yingted Jun 05 '11 at 13:53
  • A GreaseMonkey script is not a Firefox extension. – Patonza Jun 05 '11 at 18:53
  • 1
    Yes, it's not. I meant the OP should write a Firefox extension. – yingted Jun 15 '11 at 02:20
0

If the VOIP provider is Skype, you can open [skype:ohadcn?call][1] (replace ohadcn with your user name) just as you open any link, and it will open Skype.

Besides, if you are the VOIP provider, you can register your program to handle a protocol and open it that way.

[1]: skype:ohadcn?call

Beryllium
  • 12,808
  • 10
  • 56
  • 86
Ohad Cohen
  • 5,756
  • 3
  • 39
  • 36