Home
About
Search
Welcome to M-Files Empower – our new support experience. We'd love to hear what you think!Give feedback
Home/Support and troubleshooting/Troubleshooting/Error resolution

JSON is undefined error from UI Extensibility Apps

Last updated on 1 December 2022 · 3 min read

Admin
UI Extensibility Framework

Overview

When browsing a vault and/or interacting with UI Extensibility applications (both custom and ones from M-Files such as View Extensions or Theme Editor), you may get an error similar to

« JSON » is undefined

Sample stack trace:

CustomControlSite.cpp, 1051, " JSON " is undefined (0x80040008)

M-Files View Extensions: ThemeUtil.js, 207, " JSON " is undefined (0x80040008)

MErrorHelper.cpp, 2457, " JSON " is undefined (0x80040008)

(M-Files 21.6.10322.8)

There should be a line that lists the application name, the name of the file that threw the exception, the line on which it was thrown. In this example, these are "M-Files View Extensions", "ThemeUtil.js", "207".

Background

Especially in custom applications, you may get similar errors about other objects that are supported only by modern browsers, if your application uses them.

This particular error indicates that the JSON object the browser should provide does not exist, which can happen with browsers like Internet Explorer 7 and earlier.

If you get similar unexpected errors about general browser features (for example, the querySelector() method), and especially if they happen only in some environments, it is likely that the browser runtime that the OS provides to the application code is old, likely Internet Explorer running in Compatibility View.

Solution

If the error comes from the Theme Editor application (the error stack would mention its name), upgrade it to 2.1.35.0 or later. Requires logout > login on the client to get the new version.

If this does not help, or the source is difference, take steps to reduce the chance of Compatibility View being used as the browser runtime. There are two ways to do this, consider employing both, if both are available to you.

Meta tag in the source code of the application

Add the following meta tag to the .html page of your application as the first line in the <head> tag:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Compatibility View Settings

Use the Internet Explorer settings to disable Compatibility View for intranet sites. Ensure that "localhost" is not added to the explicit list of sites that display in Compatibility View. You need to do this for every user that uses the computer. In multi-user environments similar to Citrix XenApp, the setting must be applied to the server that actually runs the M-Files Client. You can deploy this setting with GPO (see more in the following Microsoft article: Group Policy and compatibility with Internet Explorer 11). (If opening IE causes a direct opening of Edge, go to the settings in Edge, default browser and set “let internet explorer open pages in Microsoft Edge” to never.)

Figure 1: Open Compatibility View Settings (you may need to press F10 to get the toolbar)

image.png

Figure 2: Compatibility View Settings - exclude localhost, and intranet sites

image.png

Still need help?