简体   繁体   中英

File attachment is not working in other Browser except IE

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

Unfortunately (as per this answer ), ActiveX is a Microsoft specific implementation and not part of any other standards (eg 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM