Search code examples
javascriptoauth-2.0hl7-fhirdstu2-fhirsmart-on-fhir

SMART on FHIR client-js: Invalid Character Error on IE11


Note: The issue is also reported on GitHub. Please take a look at Git issue as well for current progress/investigation.

I'm using fhir-client v0.1.15 to develop a SMART on FHIR web application that would run in EHR launch scenario. For example in Epic Hyperspace simulator that uses IE to run the SMART application.

While testing my application locally(localhost) on IE11, I get a JavaScript error from within fhir-client.js.

SCRIPT1014: Invalid character

File: fhir-client.js, Line: 38113, Column: 3

Below are the two lines from code. 38112 & 38113 in order:

  var ret = Adapter.get().defer();
  var state = JSON.parse(sessionStorage[params.state]);

Any solution or workaround would be much appreciated.

Updated Upon further investigation we found that sessionStorage is empty when line with JSON.parse executes. However, strange thing is why/how sessionStorage gets empty after redirection from authorization server. This only happens with IE11, everything works fine on Chrome though.

PS. Can someone please add a new tag SMART or SMARTonFHIR?


Solution

  • Though I couldn't find the exact root cause and solution but let me share the findings that helped me resolve this issue somehow.

    The issue doesn't exist when I test my SMART application with redirect_uri(in FHIR.oauth2.authorize call) set to a staging server URL instead of localhost.

    PS. I’m open to better, and more qualified answers for acceptance.