0

I am using This code to attach any file to Outlook, This is working fine with IE But in other Browser it's not working.

<html>
    <head>
    <script type="text/javascript">
        function OpenOutlookDoc()
        {
            var xmlhttp;

            try
            {
                if (window.XMLHttpRequest)
                {
                    outlookApp=new XMLHttpRequest("Outlook.Application");
                }
                var outlookApp = new ActiveXObject("Outlook.Application");
                var nameSpace = outlookApp.getNameSpace("MAPI");
                mailFolder = nameSpace.getDefaultFolder(6);
                mailItem = mailFolder.Items.add('IPM.Note.FormA');
                                mailItem.Attachments.Add ("C:\\Users\\bhaskeak\\Desktop\\temp\\Doc.docx");
                                mailItem.Attachments.Add ("D:\\Capaaature.png");          
                                mailItem.display (0);
            }
            catch(e)
            {
                alert(e);
                // act on any error that you get
            }
        }
    </script>
    </head>
    <body>
        <a href="javascript:OpenOutlookDoc()">Click</a>
    </body>
</html>

Please Help me Gave some solution so that it will work in other Browser

Cœur
  • 37,241
  • 25
  • 195
  • 267
DPD
  • 13
  • 2

1 Answers1

0

Unfortunately (as per this answer), ActiveX is a Microsoft specific implementation and not part of any other standards (e.g. the ones other browsers support).

Given (I presume from your code) that this appears to be something you'll be hosting locally or single purpose, it might be worth building this as a plugin for the browser you wish to use. Alternatively you could look at Firebreath if you require cross browser support, but be prepared for some hurdles!

Community
  • 1
  • 1
Andrew White
  • 600
  • 1
  • 9
  • 29
  • Thank You Andreew For your Reply ,I am not implementing it for single use ,I have to puct in my project in future but It is working only for IE thats why I am trying to find another solution . – DPD Apr 16 '14 at 13:07
  • In that case, you'll need to use something like Firebreath, however unfortunately the way to use this is probably beyond the scope of Stackoverflow - you'll need to spend some time learning this implementation before proceeding. – Andrew White Apr 17 '14 at 08:23