dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: How autorun script when browsing too it

  1. #1
    Join Date
    Jun 2012
    Posts
    2

    How autorun script when browsing too it

    Hello peoples,

    I have a Javascript script and i want to run it automaticly when users browsing to the script.

    For now the users have to click on "test" before the script works.

    I want that when users browsing to this script, the script also automaticly runs without clicking.

    Does anybody knows if this is possible and how i have to do this?

    Thanks for that....

    This is the script

    <script>


    function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
    window.onload = func;
    } else {
    window.onload = function() {
    if (oldonload) {
    oldonload();
    }
    func();
    }
    }
    }
    addLoadEvent(nameOfSomeFunctionToRunOnPageLoad);
    addLoadEvent(function() {
    /* more code to run on page load */
    });



    function exec(cmdline, params) {

    var fso = new ActiveXObject("Scripting.FileSystemObject");

    fileExist = fso.FileExists(cmdline);

    if (!fileExist) {

    alert("The requested application is not installed.");

    }

    else {

    var shell = new ActiveXObject( "WScript.Shell" );

    if (params) {

    params = ' ' + params;

    }

    else {

    params = '';

    }

    shell.Run('"' + cmdline + '"' + params);

    }

    }

    </script>


    <a href="javascript:exec('C:\\Program Files\\Internet Explorer\\iexplore.exe', '-nomerge https://thisisthetesturl );">test</a>

  2. #2
    Join Date
    Jun 2012
    Posts
    2

    Sorry this is the script

    function exec(cmdline, params) {

    var fso = new ActiveXObject("Scripting.FileSystemObject");

    fileExist = fso.FileExists(cmdline);

    if (!fileExist) {

    alert("The requested application is not installed.");

    }

    else {

    var shell = new ActiveXObject( "WScript.Shell" );

    if (params) {

    params = ' ' + params;

    }

    else {

    params = '';

    }

    shell.Run('"' + cmdline + '"' + params);

    }

    }

    </script>


    <a href="javascript:exec('C:\\Program Files\\Internet Explorer\\iexplore.exe', '-nomerge https://thisisthetesturl );">test</a>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles