{"record":{"id":"c2f48fc9d7eab638","repo":"octobercms/october","slug":"the-browser-does-not-support-the-formdata-interfac","errorCode":null,"errorMessage":"The browser does not support the FormData interface.","messagePattern":"The browser does not support the FormData interface\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/system/assets/js/framework.js","lineNumber":330,"sourceCode":"      const op = this.getOps(\"redirect\")[0];\n      return op?.url || this.redirect || null;\n    }\n    getReload() {\n      return this.getOps(\"reload\")[0] || null;\n    }\n  };\n\n  // ../../vendor/larajax/larajax/resources/src/request/options.js\n  var Options = class {\n    constructor(handler, options) {\n      if (!handler) {\n        throw new Error(\"The request handler name is not specified.\");\n      }\n      if (!handler.match(/^(?:\\w+\\:{2})?on*/)) {\n        throw new Error('Invalid handler name. The correct handler name format is: \"onEvent\".');\n      }\n      if (typeof FormData === \"undefined\") {\n        throw new Error(\"The browser does not support the FormData interface.\");\n      }\n      this.options = options;\n      this.handler = handler;\n    }\n    static fetch(handler, options) {\n      return new this(handler, options).getRequestOptions();\n    }\n    // Public\n    getRequestOptions() {\n      return {\n        method: \"POST\",\n        url: this.options.url ? this.options.url : window.location.href,\n        headers: this.buildHeaders()\n      };\n    }\n    // Private\n    buildHeaders() {\n      const { handler, options } = this;","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/assets/js/framework.js#L312-L348","documentation":"Thrown by the Options constructor in October CMS's AJAX framework when typeof FormData === 'undefined'. The AJAX layer builds POST bodies with the FormData interface, so a JS environment without it (IE9 and older, some embedded WebViews, or server-side/SSR execution of the bundle) cannot issue requests and the constructor fails fast.","triggerScenarios":"Loading framework.js in Node/headless SSR and calling oc.request(); running the site in a legacy browser (IE9 and earlier); a stripped-down embedded WebView lacking the FormData API; test environments (jsdom beforeFormData was polyfilled).","commonSituations":"Server-side rendering accidentally executing the AJAX bundle; supporting legacy kiosk/intranet browsers; unit tests in Node that import the bundle without a DOM polyfill; rare mobile WebViews from the pre-2013 era.","solutions":["Guard the call: if (typeof FormData === 'undefined') return; before invoking oc.request()/oc.ajax()","Polyfill FormData in the offending environment (formdata-polyfill, whatwg-fetch era polyfills)","In SSR/Node tests, stub global FormData or skip framework.js execution on the server","For legacy browsers, serve a legacy build/polyfill bundle conditionally"],"exampleFix":"// before\nimport '~/modules/system/assets/js/framework-bundle.js'; // SSR: throws on request\n\n// after\nif (typeof FormData !== 'undefined') {\n  oc.request(el, 'onSave');\n}","handlingStrategy":"validation","validationCode":"if (typeof FormData === 'undefined') {\n  console.warn('This browser/runtime lacks FormData - AJAX requests disabled');\n} else {\n  oc.request(el, 'onSave');\n}","typeGuard":"const supportsFormData = () => typeof FormData !== 'undefined';","tryCatchPattern":"try { oc.request(el, 'onSave'); } catch (e) { if (/does not support the FormData/.test(e.message)) { /* polyfill or degrade gracefully */ } else throw e; }","preventionTips":["Feature-detect FormData before booting AJAX-dependent UI","Polyfill FormData in legacy browsers or SSR test environments","Keep framework.js out of server-side rendering pipelines"],"tags":["browser-compatibility","ajax","environment","polyfill"],"backgroundTag":"unsupported-browser-api","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}