Site logo

Functions for Web

Open in browser by Marc Autret

function openInBrowser(/*str*/url)
{
    var    f = new File(Folder.temp.absoluteURI +
        '/url_' + (+new Date()) + '.url' );

    var fStr = "[InternetShortcut]\rURL="+url;

    f.open('w');
    f.write(fStr);
    f.close();
    f.execute();
    f.remove();
}

// Test:
openInBrowser("http://www.indiscripts.com/");

Go to link by Marijan Tompa (tomaxxi)

function gotoLink ( url ) {
    var
        body, language;
    url = url || "http://tomaxxi.com";
    if ( isMac () )
        body = 'tell application "Finder"\ropen location "' + url + '"\rend tell',
        language = ScriptLanguage.APPLESCRIPT_LANGUAGE;
    else
        body = 'dim objShell\rset objShell = CreateObject("Shell.Application")\rstr = "' + url + '"\robjShell.ShellExecute str, "", "", "open", 1 ',
        language = ScriptLanguage.VISUAL_BASIC;
    app.doScript ( body, language );
}

JumpToLink function