Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Detect ActiveX

Reply
Thread Tools

Detect ActiveX

 
 
David C
Guest
Posts: n/a
 
      11-11-2008
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>


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      11-12-2008
On Nov 11, 7:06*pm, "David C" <(E-Mail Removed)> wrote:
> 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');

}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX control in python vs ActiveX control in vb 6 (piece of code) vml Python 0 08-22-2007 09:57 AM
Using JavaScript to detect ActiveX support in IE... Robert White Javascript 0 08-23-2005 02:24 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
Detect the ActiveX Control is able to run SiuLoBow ASP General 4 07-09-2004 09:18 PM
To detect the errors with javascript when downloading the activex object? ripken95 Javascript 0 07-23-2003 02:30 AM



Advertisments