Software Archive
Read-only legacy content
17060 Discussions

[Javascript] syntax error, when running examples in Internet Explorer

Martin_W__K_
Beginner
1,337 Views

Hi,

when I test the Javascript examples in my Internet Explorer, a Javascript syntax error occurs.
See attached screenshot for details.

I'm using Windows 8.1 with Internet Explorer 11 (German) and latest patches/updates applied.

I've nailed the root cause down to the fact, that the 'xhr.responseText' is an empty String (see screenshot).
This will result in an exception, when calling JSON.parse(xhr.responseText).

This is my proposal for a fix

// file realsenseinfo-3.0.js
// ...
var xhr = new XMLHttpRequest();
var url = 'http://localhost:4182/Intel/RealSense/v3/' + JSON.stringify(components);
xhr.open("GET", url, true);
xhr.timeout = 1000;
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.responseText.length > 0) { // added additional length check
                var info = JSON.parse(xhr.responseText);
                info.responseText = xhr.responseText;
// ...

 

0 Kudos
0 Replies
Reply