Detect ActiveX

D

David C

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>
 
G

Guest

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');

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top