none
How to determine if running a web application in an Outlook Folder Home Page or directly in Internet Explorer? RRS feed

  • Question

  • Hi,

    I have a web application that can run in a variety of browsers including Internet Explorer.  Our users also view the web application in a Outlook Folder Home Page.  It's easy to tell what browser the user is using in general from within the web application, but I also need to be able to determine whether the web application (from within the web application itself) is running within Internet Explorer or whether it is running in an Outlook Folder Home Page. 

    How can I tell whether my web page is running in an Outlook Folder home page vs. Internet Explorer?  I've unsuccessfully tried all of these things:

    1. Checking window.location.protocol.  This is initially 'outlook:', but our web app gets redirected through a security page and after the user logs in, the user is returned to the same page-- but at this point the protocol is http (indistinguishable from IE)

    2. document.referrer doesn't tell me anything (I was hoping to get page with outlook scheme before redirect)

    3. IE conditional comments looking for 'mso'

    4. window.getObject() cannot be used to determine whether Outlook process is running from within a web page (this is a security restriction).

    What else can I try?

    Thanks,

    Notre

    Thursday, March 6, 2014 5:19 AM

Answers

  • Hello Notre,

    It looks like the issue is not related to Outlook only due to the fact that Outlook object model doesn't provide anything for this.

    The web page is loaded by the Web browser control which can be embedded into Outlook or any other application. In my opinion the real question is how to detect the host application of the web browser control. If so, I'd suggest asking such questions in the Internet Explorer Web Development or Internet Explorer Extension Development  forums instead. There you will get the most qualified answers.

    Thursday, March 6, 2014 1:22 PM
  • If a folder home page is set a MAPI property on the folder will be set: PR_FOLDER_WEBVIEWINFO. That contains the URL of the folder home page and some additional information.

    That would have to be read from Outlook and the folder using Outlook code of some sort (object model code, Extended MAPI, etc.). I don't think that you can do that from your browser object model code for security reasons.


    Ken Slovak MVP - Outlook

    Friday, March 7, 2014 4:35 PM
    Moderator

All replies

  • Hello Notre,

    It looks like the issue is not related to Outlook only due to the fact that Outlook object model doesn't provide anything for this.

    The web page is loaded by the Web browser control which can be embedded into Outlook or any other application. In my opinion the real question is how to detect the host application of the web browser control. If so, I'd suggest asking such questions in the Internet Explorer Web Development or Internet Explorer Extension Development  forums instead. There you will get the most qualified answers.

    Thursday, March 6, 2014 1:22 PM
  • Hi Eugene,

    I will certainly ask the question in those forums.  I wanted to ask here as well, in case there is anything specific to Outlook and Outlook Home Page folders I could leverage.  For example, some unique registry that changes the use agent, or something Outlook does when hosting the web browser control.  I know it's possible, as a host of the web browser control, to inject extra stuff into the browser object model and I'd like to know if Outlook does anything like that I might be able to leverage.

    Thanks,

    Notre

    Thursday, March 6, 2014 5:29 PM
  • Notre,

    You can treat Outlook as a regular application which hosts a Web browser control.

    Thursday, March 6, 2014 5:37 PM
  • I wish I could treat Outlook like any other application which hosts a web browser control:) I did post the same question in the IE forum, as you suggested.  

    In case you're interested, one of the problems I'm trying to solve is the same one asked here:

    http://social.msdn.microsoft.com/Forums/ie/en-US/9166ea0e-c5b2-47d2-a444-eef3d8873831/outlook-2007-using-cookies-in-folder-home-pages?forum=outlookdev

    In that question, the suggestion was to add use an addin.  I don't have that luxury; I can't install anything on my user's machine.  And to answer the question asked by the original person in that thread, cookies don't work under Outlook.  If using Outlook and IE 8, I made my code fallback to userData DHTML persistence, but that doesn't work with IE9+.  There are other behavioural reasons why I'd like to know whether the application is running in Outlook vs. IE directly, but I won't bore you with the details.

    Thursday, March 6, 2014 5:52 PM
  • Notre,

    As I said, the Outlook object model doesn't provide anything for this.

    Thursday, March 6, 2014 6:01 PM
  • I understand it doesn't provide anything in the object model (presumably that's callable from COM or .NET), but when Outlook hosts the web browser control does it inject anything into the DOM/global script that I might be able to branch off of?

    Thanks,

    Notre

    Thursday, March 6, 2014 6:13 PM
  • Notre,

    No, it doesn't inject anything.

    Thursday, March 6, 2014 6:47 PM
  • Ok, thanks Eugene.  I really appreciate your feedback.  I'll keep this post open for a little bit and respond if any answers come up in the other forums.
    Thursday, March 6, 2014 7:49 PM
  • You are always welcome, Notre.
    Thursday, March 6, 2014 9:20 PM
  • If a folder home page is set a MAPI property on the folder will be set: PR_FOLDER_WEBVIEWINFO. That contains the URL of the folder home page and some additional information.

    That would have to be read from Outlook and the folder using Outlook code of some sort (object model code, Extended MAPI, etc.). I don't think that you can do that from your browser object model code for security reasons.


    Ken Slovak MVP - Outlook

    Friday, March 7, 2014 4:35 PM
    Moderator
  • Thanks Ken for that info.  It makes sense. I'm beginning to accept that there's not going to be a zero footprint solution.

    Notre

    Friday, March 7, 2014 5:17 PM