So gehts mit IE und Javascript!! (Ulf): Links NICHT im Browser öffnen (z.B. .xls)?

Beitrag lesen

So. Nicht schön aber funktionell. Geht ab IE 5.0 und höher...
Code ist aus Sharepoint rausgenommen und zusammengefasst...bestimmt kann man noch ein wenig schöner drin rumfuddeln aber es tut, was es soll:

Es öffnet eine XLS Datei in Excel (und fragt vorher, ob der "Upload" zu dem eigenen Rechner gestattet ist)...

<script language="javascript">

function go()
{
    var strTemplate = "http://www.meinserver.de/test.XLS";
    var strSaveLocation = "";
    var strProgID = "SharePoint.OpenDocuments";

var fRefreshOnNextFocus = false;

var L_NewDocumentRuntimeError_Text = "The document could not be created. Langer Fehlertext...";
    var L_NewDocumentError_Text = "'New Document' requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 5.0 or greater. To add a document to this document library, click the 'Upload Document' button.";

try
    {
        var objEditor = new ActiveXObject(strProgID + ".1");
        window.onfocus = null;
        if (!objEditor.CreateNewDocument(strTemplate, strSaveLocation))
            alert(L_NewDocumentRuntimeError_Text);
        //SetWindowRefreshOnFocus();
        return;
    }
    catch (e)
    {
        alert(L_NewDocumentError_Text);
    }
}
</SCRIPT>
<a href="javascript:go();">link</a>