By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,088 Members | 992 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,088 IT Pros & Developers. It's quick & easy.

Detect ActiveX

P: n/a
I have an ASP.Net page that displays documents as hyperlinks from a network
folder (intranet application). I also have a column that contains a
hyperlink to open the document in Microsoft Word. All works fine unless
someone has ActiveX disabled on their browser. Is there any way I can
detect that so I can give them a warning?

The script for opening a Word document is below. Thanks.

-David

<script language="javascript" type="text/javascript">

function openWord(spath)
{
var pause = 0;
var wdDialogFileOpen = 80;
var wdApp = new ActiveXObject("Word.Application");
wdApp.Visible = 'True';
var wdDoc = wdApp.Documents;
wdDoc.Open(spath);
document.form1.submit();
}

</script>
Nov 11 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 11, 7:06*pm, "David C" <dlch...@lifetimeinc.comwrote:
I have an ASP.Net page that displays documents as hyperlinks from a network
folder (intranet application). I also have a column that contains a
hyperlink to open the document in Microsoft Word. *All works fine unless
someone has ActiveX disabled on their browser. *Is there any way I can
detect that so I can give them a warning?

The script for opening a Word document is below. *Thanks.

-David

<script language="javascript" type="text/javascript">

function openWord(spath)
{
* * var pause = 0;
* * var wdDialogFileOpen = 80;
* * var wdApp = new ActiveXObject("Word.Application");
* * wdApp.Visible = 'True';
* * var wdDoc = wdApp.Documents;
* * wdDoc.Open(spath);
* * document.form1.submit();

}

</script>
Hi David,

I think you can simply add the try..catch block to check the result of
ActiveXObject

try {

var wdApp = new ActiveXObject("Word.Application");
wdApp.Visible = 'True';
var wdDoc = wdApp.Documents;
wdDoc.Open(spath);
document.form1.submit();

} catch (er) {

alert('You have no Word ActiveX');

}
Nov 12 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.