Internet Explorer 11 crashes when JSON.stringify is called on an HTMLFormElement that contains duplicate named inputs. This is particularly concerning because radio inputs will certainly have duplicate names.

In these simplified recreation steps, we can reliably crash Internet Explorer 11 (11.103.10586) by passing a simple HTMLFormElement into JSON.stringify. This is impacting some TrackJS customers, and the Tracker JavaScript Agent itself, which calls JSON.stringify when attempting to serialize console arguments.

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <h1>IE11 Freezes on JSON.Stringify</h1>

    <form id="my-form">
      <input name="emailoptin"  />
      <input name="emailoptin"  />
    </form>

    <button id="freeze-me" onclick="JSON.stringify(document.getElementById("my-form"))">Freeze Me</button>

  </body>

</html>
Bug Reproduction Markup

Solution

We are considering alternatives to avoid this bug, but in the meantime you can avoid this issue by adding a custom serializer to your TrackJS configuration that does not use JSON.stringify. For example:

TrackJS.install({
  token: "YOUR_TOKEN",
  serialize: function (item) {
    return ""+item;
  }
});
Did you like this?
CEO TrackJS
Todd is a software engineer, business leader, and developer advocate with 20+ years of experience. He is a co-founder and CEO of TrackJS and Request Metrics,...

What to do Next:

1. Try TrackJS on Your Website

TrackJS gives you the visibility to find and fix your errors before users find them. Get started in 5 minutes tracking errors with all the context you'll need to squash the important bugs in your app.

2. Get the Debugger Newsletter

Join The Debugger for amazing JavaScript tips, debugging walkthroughs, news, and product releases for Request Metrics. No more than once a week, probably a lot less.