Current position:  Home > Default > Exception in javascript library when testing Mail app with IE9/ Safari

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

Time:October 11
Advertisement
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
Advertisement
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