how can i launch an application using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rotaryfreak
    New Member
    • Oct 2008
    • 74

    how can i launch an application using javascript

    hi everyone,

    im fairly new to javascript so here goes: Im building an application that requires a database (i'm using wampserver) and i want to create a desktop icon which is a shortcut to the login page for the program. When the user double clicks the shortcut on the desktop, i want to automatically launch the wamp server. Ive done a little research and google has told me this is possible but only using ActiveX. Firefox may block the application...
    The thing is, im following code samples from google and it is not working; maybe i'm doing something wrong?
    or maybe what i want to do is not possible?

    (for simplicity, i've included my javascript code in my html code)

    this is what i'm doing:

    Code:
    <head>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link rel="stylesheet" title="loginPage" type="text/css" href="loginPage.css" /> 
            
    <script Language="JScript">
    	function runcmd() {
    		File="C:\Program Files\Wamp Server\wampmanager.exe";
    		WSH=new ActiveXObject("WScript.Shell");
    		WSH.run(File);
    	}
    </script> 	
    
    		<title>Test page</title>
            
            
    	</head>
    
    
    
    	<body onLoad="javascript:runcmd();"> 
        			<div id="login">
                    <form action="userLogin.php" method="post" enctype="multipart/form-data" name="userLoginInfo">
                   		<label>Login: </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input name="userName" type="text" size="15" maxlength="10" />
                        
                        <br />
                        
                        <label>Password: </label>
                        <input name="password" type="password" size="15" maxlength="10" />
                        
                        <br />
                        
                        <input name="loginButton" type="button" value="Login" />
                    
                    </form>
    					
                    </div>
            
        
    	</body>
        
    </html>



    any guidance will be appreciated :)
    thx
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    that approach won’t work in any other browser than IE. in general, JavaScript has no access to the client’s file system (a security measure).

    is your application a web application or a desktop application?

    Comment

    • rotaryfreak
      New Member
      • Oct 2008
      • 74

      #3
      im trying to create a web application. For now though, it will run on the local server but eventually i would like to get a domain name and host server :)

      thanks again

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        if it should run on a host server eventually, there’s no problem. in that case the DB/webserver will run all the time. even if you have a local test server, just make sure all required services (i.e. webserver & DB server) are started on booting.

        Comment

        Working...