locked
ActiveXObject is not working in IE 8 and above versions RRS feed

  • Question

  • User-1324453634 posted

    HI ALL,

    Below code is not working in IE 8 and above versions, I am using Windows 7 Operating System

    <html>
    <head>
    <script language="javascript">
    function Write()
    {
    var Scr = new ActiveXObject("Scripting.FileSystemObject");
    var CTF = Scr.CreateTextFile("C:\\Gyan.txt", true);
    CTF.WriteLine('Roseindia');
    CTF.Close();
    }
    </script>
    </head>
    <body onLoad="Write()">
    </body>
    </html>

    can any one help me please

    Thanks in Advance

    Tuesday, July 17, 2012 7:56 AM

Answers

  • User78336405 posted

    Hi,

    To launch an application on the client machine, place this script in the head of the HTML page.

    <script language="javascript" type="text/javascript"> 
    function runApp() 
    { 
    var shell = new ActiveXObject("WScript.shell"); 
    shell.run("notepad.exe", 1, True); 
    } 
    </script>

    Only IE has support for ActiveX, so this won't work in any other browser. The user must answer "YES" to a warning that the page is trying to execute ActiveX code.

    Additionally, the ws.Exec command is available only in Windows Script Host 5.6 which is standard in Win 2k and XP, but not in earlier versions.

    Alternatively, if you use for example,

    location.href = "C:\\Program Files\\Adobe\\Photoshop 6.0\\Photoshp.exe";

    the browser will give a file-download dialog to which the user must choose "Open".

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 18, 2012 2:07 AM

All replies

  • User-1662386854 posted

    IE8 internet setting is more secure, to it doesn't allow activex objects.

    If you have to run this, goto Tools->Internet Options-> Security->Custom Level->choose enable or prompt activex.

    try Custom Level -> ActiveX controls and plug-ins -> Initialize and script ActiveX controls not marked as safe for scripting

    Hope it helps.

    Tuesday, July 17, 2012 9:51 AM
  • User78336405 posted

    Hi,

    To launch an application on the client machine, place this script in the head of the HTML page.

    <script language="javascript" type="text/javascript"> 
    function runApp() 
    { 
    var shell = new ActiveXObject("WScript.shell"); 
    shell.run("notepad.exe", 1, True); 
    } 
    </script>

    Only IE has support for ActiveX, so this won't work in any other browser. The user must answer "YES" to a warning that the page is trying to execute ActiveX code.

    Additionally, the ws.Exec command is available only in Windows Script Host 5.6 which is standard in Win 2k and XP, but not in earlier versions.

    Alternatively, if you use for example,

    location.href = "C:\\Program Files\\Adobe\\Photoshop 6.0\\Photoshp.exe";

    the browser will give a file-download dialog to which the user must choose "Open".

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 18, 2012 2:07 AM