Use JavaScript to invoke local programs in Firefox

Source: Internet
Author: User

http://blog.csdn.net/jensonhjt/article/details/1765557

<Script>

functionHello (){
   Netscape.security.PrivilegeManager.enablePrivilege ( " universalxpconnect " );
   var &NBSP;FILE&NBSP; =  components.classes[ " @mozilla. org/file/local;1 " ].createinstance (Components.interfaces.nsILocalFile);
  file.initwithpath ( " d:/ Program files/foobar2000/foobar2000.exe "   file.launch ();
}

Script>

The above code executes the program without parameters, and the following code executes the program with the parameter added.

functionHello (){
varOurl= "www.baidu.com";

Netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect");
varProcess=components.classes['@mozilla. Org/process/util;1'].getservice (Components.interfaces.nsIProcess);
varTargetFile=components.classes['@mozilla. Org/file/local;1'].createinstance (Components.interfaces.nsILocalFile);

Targetfile.initwithpath ("D:/temp/1.exe");
Process.init (targetfile);
vararguments=[Ourl]; //The arguments parameter must be an array, otherwise the following statement does not execute

Process.run (false, arguments, Arguments.length,{});
}
Read (2904) | Comments (0) | Forwards (0) |0

Previous: JavaScript call EXE program (Windows) Pass parameters

Next: Use JS to determine the browser type (IE,FIREFOX)

Related Popular articles
    • Tracing memory leaks with process information ...
    • Webcam Avcodec_encode_video2 ...
    • Make multi-version Fedora system installation U ...
    • Three ways to call system under Linux ...
    • Could not find a part of the ...
    • About SSI
    • IP Sec VPN and Nat reunion
    • JS Analog Mouse Auto Click
    • UT2.0 official version download
    • tomcat6.0 configuration (with configuration video download ...
    • Linux DHCP Peizhi ROC
    • Soft links to Unix files
    • What does this command mean, I'm new ...
    • What does sed-e "/grep/d" mean ...
    • Who can help me solve Linux 2.6 10 ...
Leave something to the owner! ~~ Comment on the hot topic

Use JavaScript to invoke local programs in Firefox

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.