From 041277ccaebd6de69624e4e501e97b3d0ae391a5 Mon Sep 17 00:00:00 2001 From: Zack Stickles Date: Wed, 23 Sep 2020 10:43:57 -0700 Subject: [PATCH] fix: only reference mktoForms2 when available --- gatsby-browser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gatsby-browser.js b/gatsby-browser.js index 68fcc6cd9..54dca922a 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -41,10 +41,12 @@ const onInitialClientRender = () => { } } - // eslint-disable-next-line no-undef - MktoForms2.whenRendered(function (form) { - destyleMktoForm(form); - }); + if (typeof window !== 'undefined' && window.MktoForms2) { + // eslint-disable-next-line no-undef + MktoForms2.whenRendered(function (form) { + destyleMktoForm(form); + }); + } }; const onRouteUpdate = ({ location }) => {