I'm opening a word document through IE on a local network, it opens up fine 开发者_JAVA百科but if a document is password protected then it should prompt for the password which it doesn't.
Is there something that I should be doing to get the password prompt?
The way I'm opening the document is by a link on a web page e.g.
<a href="\\path\to\file.doc">Document</a>
I've got what I want working using the following javascript/jQuery. jQuery is not required, I used it as I already have it as part of the project.
$('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;
});
In case you are ok with having the document open in Word itself (and not in IE), maybe this will point you in the right direction:
http://www.velocityreviews.com/forums/t109523-open-word-doc-in-word-not-in-browser.html
精彩评论