I am trying to embed a Facebook video in an EE channel entry.

I find that when the entry field is formatted as either Markdown or XHTML EE is rewriting part of the javascript in a way that makes the video embed break on the Facebook side.

Generally I can prevent EE from munging my javascript within entries by wrapping the script in a CDATA declaration.

However in this case EE's Typography engine is rewriting:

js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";


js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";

(& is rewritten to &)

Which gives the following error in the browser console:

Uncaught Error: invalid version specified

My work-around is to set the field format as None.

Is there a way I can keep the format as XHTML short of making a global change to the site's typography settings?

I am using EE version 2.8.1

1 Answer 1


In what context is this an issue?

js.src = "{your_tag}".replace("&", "&");

(whoa, they updated the guide theme)


You could probably write your own specific extension that hits the typography_parse_type_end hook and simply modifies those ampersand replacements back in. This would take control away from the user; but honestly there is certainly no security risk in the JS version, but to take control of the parser's typography and allow ampersands back in could put you in precarious positions. There is a reason it gets parsed out.

  • Interesting approach. I think something like this would work. I was really hoping for answer that would explain and control EE Typography a little better, but if there's no server-side answer you'll get the bounty.
    – AllInOne
    Oct 14, 2015 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.