none
Exception in javascript library when testing Mail app with IE9/ Safari RRS feed

  • Question

  • Hi,

    I have almost finished my mail app, but a strange issue that only appears with IE9 prevents me from successfully completing the verification process and therefore I can not publish my app.

    The issue is very similar to this post, which could unfortunately not have been answered so far:

    'OSF is undefined' script error in o15apptofilemappingtable.js file when Mail App launched

    I have tested the app successfully with the following browsers: Chrome (40.0.2214.111 m), Firefox (35.0.1), IE 11 and IE 10.

    In IE9 I first get:

    App Error Something went wrong and we couldn't start this app. Please try again later or contact your system administrator.

    When I then click "retry" I get:

    App Error This app may not load properly, but you can still try to start it.

    After I click start the app works. The debug console of IE indicates that there is a problem in the o15apptofilemappingtable.js file:

    SCRIPT438: Object doesn't support property or method 'GetContext' o15apptofilemappingtable.js, line 11 character 110934


    The problem should be the call to: "window.external.GetContext()" in the file mentioned above.

    Important to mention is, that when I build and deploy the sample mail project that ships with Visual Studio it just works fine (this is a difference to the other thread from above). There must be something special with my code but even after days of research I can absolutely not figure out what it is. In contrast to the sample mail app, my project is an ASP.NET MVC application by the way (if that is important).

    To isolate the problem I tried several things:

    * I have removed all other javascript libraries to make sure that there are no conflicts between them.

    * I removed all javascript code except the Office.initialize= ... code to be sure that there isn't a problem with my custom javascript code. 

    But whatever I tried it doesn't help and basically I am fishing in troubled waters as I do not have an idea what the real problem is and why it is only happening on IE9.

    Best regards

    Stefan



    • Edited by ___Stefan___ Thursday, February 12, 2015 7:52 PM
    Sunday, February 8, 2015 6:34 PM

Answers

  • Hi Phil,

    Thanks for your input! 

    My application is an ASP.NET MVC application and yes it includes redirects. Hm...

    When my app is called, I have an authorization filter to check wheter the user is logged in and if I need to redirect him to the login page. This defenitely happens at the first call and makes absolute sense in my opinion.

    According to this thread:

    URL Fragment and 302 redirects

    Safari 5 and IE9 and below drop the original URI's fragment if a redirect occurs. 

    If IE <= 9 and Safari < 5 should be supported in the future it would be worth considering an alternative initialization of the app framework: You pass the hash as a normal url parameter and require the consuming developer to initialize the javascript api with that hash (?).

    Right now I assume we have two options:

    1. Don't allow redirects

    2. Add IE > 9 and Safari > 5 to the system requirements



    • Edited by ___Stefan___ Friday, February 13, 2015 11:47 AM
    • Marked as answer by ___Stefan___ Tuesday, February 17, 2015 7:12 AM
    Friday, February 13, 2015 8:08 AM

All replies

  • Hi Stefan,

    As I have no experience on developing Mail App, I'll involve some other engineer into your case. This will take some time, so please be patient. If there're any updates we'll come back.

    Thanks for your understanding.


    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.

    Monday, February 9, 2015 7:20 AM
    Moderator
  • Hi,

    in the meantime I noticed that I also get this problem with Safari.

    I started to debug the office api and could isolate the problem further. 

    Please forward the following information to the responsible microsoft engineer as it contains valuable information to fix the problem.

    The Exception I get happens becaus of a call to window.external.GetContext() in in the o15apptofilemappingtable.js.  The calls happens because in the function OSF.InitializationHelper.prototype.getAppContext, the value of this._hostInfo.isRichClient is true. Looks like in IE9 and Safari the api thinks it is running in the desktop version of outlook (but of course it is not and therefore the call to window.external fails -> I guess only available/set in desktop environment).

    The api thinks of running as rich client becaus the XdmInfoValue does not exist in o15apptofilemappingtable.debug.js line 155 (it is undefined). I am not a javascript specialist and don't know what xdm stands for (cross domain? X-Document?) but however:

    the xdm part which should be passed in the window.location as a hash value is not set in IE9/ Safari.

    At this position I lose the scent and don't know where the xdm part is passed/added to the url. Perhaps in the osfruntime.js? Unfortunately I couldn't find a debug version of this file.

    Please do not hesitate to contact me if you have further questions

    Regards

    Stefan


    • Edited by ___Stefan___ Thursday, February 12, 2015 8:12 PM
    Thursday, February 12, 2015 8:09 PM
  • Hi Stefan

    window.location.hash is a browser API should return anything after the character '#' in window.location.  What's the whole value of window.location?  You are right that we set the URL (and #) in osfruntime.js, as part of opening the iframe holding the app.  Other things to check, does your app change window.name, window.location or do any redirects by any chance?

    It is surprising that it only happens in IE9/Safari.  I have also asked others who are more familiar on this.

    Thanks

    Philip

    Friday, February 13, 2015 2:28 AM
  • Hi Phil,

    Thanks for your input! 

    My application is an ASP.NET MVC application and yes it includes redirects. Hm...

    When my app is called, I have an authorization filter to check wheter the user is logged in and if I need to redirect him to the login page. This defenitely happens at the first call and makes absolute sense in my opinion.

    According to this thread:

    URL Fragment and 302 redirects

    Safari 5 and IE9 and below drop the original URI's fragment if a redirect occurs. 

    If IE <= 9 and Safari < 5 should be supported in the future it would be worth considering an alternative initialization of the app framework: You pass the hash as a normal url parameter and require the consuming developer to initialize the javascript api with that hash (?).

    Right now I assume we have two options:

    1. Don't allow redirects

    2. Add IE > 9 and Safari > 5 to the system requirements



    • Edited by ___Stefan___ Friday, February 13, 2015 11:47 AM
    • Marked as answer by ___Stefan___ Tuesday, February 17, 2015 7:12 AM
    Friday, February 13, 2015 8:08 AM
  • I can confirm that the issue is caused by the redirect. I have redesigned my login procedure to work without redirects. Nevertheless a fix for this is needed (see previous post).
    Tuesday, February 17, 2015 7:15 AM
  • Hi Stefan,

    Thanks for the feedback and thanks for confirming the issue with the redirect.  I have passed your question and suggestion to somebody more familiar with how redirect is handled.

    One more question if I may, did your very first page (before redirect) include office.js?  Our initialization should try to save the xdminfovalue for subsequent pages, but I can very well be mistaken on how that works.

    Thanks

    Philip

    Wednesday, February 18, 2015 11:05 PM
  • Hi Phil,

    I'm glad I could help.

    Yes the first page (as well as all other pages) includes the office.js and the required initialization code.

    Regards

    Stefan

    Thursday, February 19, 2015 7:22 AM