Mautic Community Forums

Email Builder Showing Javascript Code

Hi Guys,



I made a custom template and when I open the builder all is fantastic. When I make changes to the email and then close builder, I view the content and it shows a huge chunk of javascript at the top of the email.



Is there something I have done wrong in the template? This is NOT my js code, in fact I have no javascript on the page.



This only appears when I click “Content” to view the email after using the builder.

Code:
// (function(){var g=this,h=function(b,d){var a=b.split("."),c=g;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)a.length||void 0===d?c[e]?c=c[e]:c=c[e]={}:c[e]=d};var l=function(b){var d=b.length;if(0=d.offsetHeight)a=!1;else{c=d.getBoundingClientRect();var f=document.body;a=c.top+("pageYOffset"in window?window.pageYOffset:(document.documentElement||f.parentNode||f).scrollTop);c=c.left+("pageXOffset"in window?window.pageXOffset:(document.documentElement||f.parentNode||f).scrollLeft);f=a.toString()+","+c;b.b.hasOwnProperty(f)?a=!1:(b.b[f]=!0,a=a=b.e.height&&c=b.e.width)}a&&(b.a.push(e),b.d[e]=!0)};p.prototype.checkImageForCriticality=function(b){b.getBoundingClientRect&&q(this,b)};h("pagespeed.CriticalImages.checkImageForCriticality",function(b){n.checkImageForCriticality(b)});h("pagespeed.CriticalImages.checkCriticalImages",function(){r(n)});var r=function(b){b.b={};for(var d=["IMG","INUT"],a=[],c=0;c

Hi Guys,

I made a custom template and when I open the builder all is fantastic. When I make changes to the email and then close builder, I view the content and it shows a huge chunk of javascript at the top of the email.

Is there something I have done wrong in the template? This is NOT my js code, in fact I have no javascript on the page.

This only appears when I click “Content” to view the email after using the builder.

// (function(){var g=this,h=function(b,d){var a=b.split("."),c=g;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)a.length||void 0===d?c[e]?c=c[e]:c=c[e]={}:c[e]=d};var l=function(b){var d=b.length;if(0=d.offsetHeight)a=!1;else{c=d.getBoundingClientRect();var f=document.body;a=c.top+("pageYOffset"in window?window.pageYOffset:(document.documentElement||f.parentNode||f).scrollTop);c=c.left+("pageXOffset"in window?window.pageXOffset:(document.documentElement||f.parentNode||f).scrollLeft);f=a.toString()+","+c;b.b.hasOwnProperty(f)?a=!1:(b.b[f]=!0,a=a=b.e.height&&c=b.e.width)}a&&(b.a.push(e),b.d[e]=!0)};p.prototype.checkImageForCriticality=function(b){b.getBoundingClientRect&&q(this,b)};h("pagespeed.CriticalImages.checkImageForCriticality",function(b){n.checkImageForCriticality(b)});h("pagespeed.CriticalImages.checkCriticalImages",function(){r(n)});var r=function(b){b.b={};for(var d=["IMG","INUT"],a=[],c=0;c

Ok to recreate the issue.

  1. Choose “New Segment Email”
  2. Choose a Template
  3. Enter a name for the email
  4. Choose a segment for the email
  5. Click “Apply”

Javascript shows up where I have an image in my template.

If no one responds Ill create an issue for this.

Created new issue:

Issue 2751

There was definitely an error in the logs…