none
Problem accessing child window opened from folder homepage in Outlook (same-origin / origin inheritance) RRS feed

  • Question

  • Hi,

    I am experiencing a problem with some versions or combinations of versions of Outlook+Windows+Internet Explorer when (programmatically) accessing child windows opened from an Outlook folder homepage.

    I have a simple script on the Outlook folder homepage which opens a child window and then attempts to write some content into it (like a popup):

    var popup = window.open('','_blank');
    popup.document.write('some content');

    This works fine in most versions of Outlook/Windows/IE, but in specific versions/environments the second lines throws a "permission/access is denied" error.

    I've found, by using the object inspector in the opened IE window, that in the cases where the script succeeds, the child window inherits the origin/location.href from the folder homepage (i.e. a URL of the kind 'outlook:...'), but in the cases where it fails, there is no origin inheritance, and instead the origin/location.href of the child window is 'about:blank'. 

    window.opener.location.href; // "outlook:..."

    window.location.href; // "outlook:..." (fine!) or "about:blank" (a problem!), depending on environment

    In order to get it working also for the case where the origin is not inherited, I have tried making changes in the IE security settings (e.g. disable any same-origin related restrictions), but this doesn't seem to help, so I guess I would like to know why the origin isn't inherited in all cases, and if this is a know issue in specific version(s) of Outlook/IE/Windows.

    Here are my results on some different environments:

    - Outlook 2007 (12.0.6776.5000) SP3 MSO (12.0.6777.5000) on Windows 10, IE11 (11.1593.14393.0/11.0.45) => Works (origin inherited)

    - Outlook 2010 (14.0.6129.5000) on Windows XP SP3, IE8 (8.0.6001.18702) => Works (origin inherited)

    - Outlook 2010 (14.0.7128.5000) on Windows 7 SP1, IE11 (11.0.9600.17207 / 11.0.10) => Fails (origin not inherited)

    - Outlook 2013 (15.0.4963.1002) on Windows 10, IE11 (11.1593.14393.0/11.0.45) => Works (origin inherited)

    Many thanks in advance for any clarification on this!

    Matts


    matek994


    • Edited by Matse Monday, February 19, 2018 1:18 PM Fixed typos.
    Monday, February 19, 2018 1:15 PM

All replies

  • Hi Matse,

    For your issue, I suggest you try the work around from link below:

    # Access is denied

    https://forums.asp.net/t/1803328.aspx?Access+is+denied

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 22, 2018 9:44 AM
  • Hi Tao,

    Thanks for helping on this issue.

    I tried the proposed solution, i.e. hosting the HTML page on a webserver instead of on a network file share, but it didn't solve the problem. 

    When the main HTML page is opened in Outlook context, as a folder homepage, it assumes an origin (window.location.href) of the form "outlook:...", no matter where the page is hosted.

    But there is obviously a different behavior on different systems as to what origin gets attached to the popup window! Which application is responsible for setting/overriding the origin of the popup window when HTML page is opened as a folder homepage in Outlook? Outlook, IE, or the OS? 


    matek994

    Thursday, February 22, 2018 10:56 AM
  • Hi Matse,

    For this issue, I assume it is related with Outlook HomePage function and IE security settings.

    You could try to update and Outlook and IE to latest version.

    >> I tried the proposed solution

    Could you share us how you tried, and a screen shot about your current result?

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 23, 2018 2:26 AM
  • Hi Tao,

    I did some more experimenting and found that the location.href property always assumes an initial value of "about:blank" in all cases, but changes to "outlook:..." only after a successful child.document.write() call from the parent window. 

    So the question is rather why the window.write() call fails with Permission Denied in one environment.

    Unfortunately I have no control over which version of Outlook and IE are used. 


    matek994

    Tuesday, February 27, 2018 7:51 PM
  • Hi Matse,

    I did not find any available solution for "window.write()".

    If you could not upgrade the Outlook or IE, I suggest you try "var popup = window.open('','_blank');" with a local web page, if it could be opened correctly from Outlook, I suggest you dynamically change the local web page before "var popup = window.open('','_blank');" for a workaround.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 1, 2018 1:47 AM
  • Hi Tao,

    Sorry, I meant of course to write window.document.write() in my previous post (and not window.write()). 

    I didn't understand your last suggestion. 

    Thanks


    matek994

    Thursday, March 1, 2018 9:48 PM
  • Could you open the local html page from "var popup = window.open('','_blank');"?

    What I mean is write the Html page, then open it from outlook.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 2, 2018 2:40 AM
  • Ok, I see. I actually thought about it, but didn't even give it a try, because I suspect this involves use of ActiveX control (which usually doesn't work because of security restrictions).

    I tried instantiating a "Scripting.FileSystemObject" ActiveXObject (in order to write content into a file that may then be opened in the popup window) on the folder homepage, and indeed, get an error message: 

    "Automation server can't create object."

    Is this the approach you were thinking of?


    matek994

    Saturday, March 3, 2018 10:41 PM
  • Hi Matse,  

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 5, 2018 6:27 AM
  • Thanks Tao. I'll have patience.



    matek994

    Monday, March 5, 2018 8:16 PM
  • Hi mate994,

    Based on the description, it seems that you want to show the dynamic content on a popup page from Outlook folder home page.

    I am still investing on the orignal issue. However for this scenario, we can use some JavaScript as a workaround. For example, we can parse the content from first page via the URL. Then we can get the content from the second page via URL and show it on the page. I also wrote a simple code to demonstrate this progress:

    First Page:

    <html>
    <head>
    <script>
    var popup = window.open('http://localhost/test2.html?content=test','_blank');
    </script>
    </head>
    <body>
    Hello!
    </body>
    </html>

    Second Page( test2.html):

    <html>
    <head>
    </head>
    <body >
    
    </body>
    <script>
    
    var query = window.location.search.substring(1);
    var queryArray = query.split("=");
    var val=queryArray[1]
    document.body.innerHTML=val
    
    </script>
    </html>

    Please let me know if it helps.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 14, 2018 10:18 AM
    Moderator
  • Hi Fei,

    Many thanks for looking into this issue!

    I'll try the workaround you propose. I have already tried some similar ideas, for example using a data-url or an object-url, none of which seem to be supported in the relevant version of IE unfortunately). I suspect that there may be a limit to the size of the data that may be transferred from the main window to the popup window using a URL query string, and in my case I have to transfer quite a large amount of data (a custom HTML print view of one or more selected email messages) not just a short message. So I will try with a few different sizes of data and report back my findings!

    Kind regards



    matek994

    Wednesday, March 14, 2018 11:19 AM
  • Hi Matse,

    Thanks for the detailed info for the scenario. To translate big date between two HTML pages, we can send the data to a queue or service in the first page via Ajax and then get it from the that queue in the second page instead of passing data directly.

    Hope it is helpful.

    Regards & Fei

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 15, 2018 2:52 AM
    Moderator
  • Hi again Fei,

    Yes, that workaround might be a better one for big data. There is a SharePoint server available on the network, which could maybe be leveraged (e.g. its webdav interface). Ideally though the folder homepage solution should have few or no dependencies on external services to ensure maximum robustness. 

    So if it is possible to clarify why the original solution (document.write()) fails in one particular case/version/environment, this would be really helpful!!


    matek994

    Thursday, March 15, 2018 8:56 PM
  • Hi matse,

    Thanks for detailed explanation.

    I also agree with you the solution is better without external service in this secnario. However after I set up the environment using Win 7 SP1 + Outlook 2010 and IE 11, the issue was still not able to reproduce:

    Can you reproduce this issue with a clean install environment?

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, March 16, 2018 10:07 AM
    Moderator
  • Hi again Fei,

    Thanks again for continued support. And for trying to reproduce the error on a similar environment. I am not as flexible in adjusting my environment, so if you agree, I would like to see if we can get to the same results.

    Windows 7 version is same: I also have Build 7601 (but I'have Professional, not Enterprise edition)

    Outlook seems to be same version, i.e. 2010 (UI in your screenshot looks identical).

    Internet Explorer: Here I'm not sure we have same setup. The IE window in your screenshot looks different from mine, but maybe we are just using different skins / appearances. Unlike in your screenshot, in my IE, the Back button is much bigger than the Forward button. When I go IE -> ? (About) -> Info, the popup says "Internet Explorer 11". And if I press F12 (dev tools) and check userAgent variable for both the popup window and the main (opener) window, I get:

    window.navigator.userAgent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; ...)"

    window.opener.navigator.userAgent: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; ...)"

    Do you have the same in your setup?

    Thanks!!


    matek994

    Monday, March 19, 2018 9:55 PM
  • Hi Matse,

    Thanks for the detailed information for the environment. I am using IE 11 on a clean machine when the Windows OS is installed fresh. So all the settings of IE is default. I also check the develop tools by F12, you can refer the settings like below:

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 21, 2018 1:22 AM
    Moderator
  • Thanks Fei.

    My thinking is the following: either the problem lies in the version of one of the involved applications (or OS), OR, the problem lies in the settings of one of the applications (for example, IE->Internet Options).

    I have tried changing all of the obvious settings in IE under Internet Options-> Security and Advanced, but it hasn't helped...

    Given that the IE version used in Outlook is not necessarily the same as the latest IE version installed on the system (in my case they are different, and I guess this is also a very common scenario in older/enterprise environments), I would like to ask you if you also have the possibility to simulate this scenario, i.e. to have IE of an older version installed when Outlook is installed, and then to upgrade IE. The specific versions of IE that I have should be evident from my previous post (although I'm not sure why the userAgent says MSIE9 when the About page says IE 11... - to do with compatibility mode?). 

    Thanks so much in advance!!


    matek994

    Wednesday, March 21, 2018 7:01 AM
  • Hi Matse,

    I am not able to find the IE 11.0.9600.17207 / 11.0.10 from Microsoft to download. To narrow down this issue, I also suggest that you update the IE to the latest version to see whether the issue is relative to version of IE.

    I also suggest that you check whether this issue is could be reproduced in a clean environment to see whether this issue is relative to settings. For example install the OS and Outlook while not changing any other settings.  

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 23, 2018 7:13 AM
    Moderator