从IE打开Word文档

Nal*_*lum 5 windows document ms-word

我在本地网络上通过IE打开word文档,它打开很好,但如果文档受密码保护,那么它应该提示输入密码而不是密码.

我是否应该采取一些措施来获取密码?

我打开文档的方式是通过网页上的链接,例如

<a href="\\path\to\file.doc">Document</a>
Run Code Online (Sandbox Code Playgroud)

Nal*_*lum 5

我有想要使用以下javascript/jQuery工作的东西.jQuery不是必需的,我使用它,因为我已经将它作为项目的一部分.

$('a.openDoc').live('click',function(){
    var file = $(this).attr('href');

    // This is what does the work.
    try
    {
        try
        {
            // get Word Active-X Object if Word is open.
            var word = GetObject('',"Word.Application");
        }
        catch(e)
        {
            // create new Word Active-X Object.
            var word = new ActiveXObject("Word.Application");
        }

        word.Visible = true; // Make sure Word is visible.
        word.Documents.Open(file); // Open the file you want.
    }
    catch(e)
    {
        alert(e.description);
    }
    // End work.

    return false;
});
Run Code Online (Sandbox Code Playgroud)