Can a greasemonkey script launch an application under windows xp
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 pas开发者_如何学运维s 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.
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
No, you can't launch an external application from greasemonkey.
For that, you would need a browser plugin.
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
精彩评论