Unhandled error when loading jQuery Mobile in a web-based Microsoft Office add-in

Unhandled error when loading jQuery Mobile in a web-based Microsoft Office add-in

There must be something different about how web pages are hosted inside any supported Office application that is running one of the new web-based add-ins (in Outlook, Word, Excel, etc.).  The following error is thrown when the page loads (while debugging in Visual Studio 2015 in my case):

 "Unhandled exception at line 2954, column 4 in jquery.mobile-1.4.5.js: 0x800a318f - JavaScript runtime error: Object expected"

I've tracked it down to this line:

    1. window.history.replaceState( state, state.title || document.title, href );

The page can continue to load if the code is altered to wrap that in a try/catch block, otherwise the loader icon appears and doesn't go away.

I'm new to jQuery Mobile so I'm not sure exactly what the purpose of the containing function is, but for reference here are the value of the parameters that are passed to the replaceState() function:

  • state.title is undefined - the cause of the exception
  • document.title = ""
  • href = https://localhost:44300/App/Home/jQueryMobileTest.html?_host_Info=Word|Win32|16.01|en-US

I've reproduced this error both in Word and Outlook add-ins.

    • Topic Participants

    • eric