I am doing a lot of A/B testing with pages. All my pages use the same template and have the same header. I need to be able to insert javascript into each page without effecting the other pages. So I created a template variable called [[*headTag]] and set this just before my closing head tag in my template.
When I visit my page in modx manger I can see the text field for [[*headTag]] and I can enter text. If I enter a simple string like "test" everything works perfectly on both ends. However when I try to paste code like <script></script> The back-end simply won't save. It just gets stuck in the saving process and says saving..please wait but it never ends.
My [[*headTag]] is a simple text area. The output is set to "default"
Has anyone else had this problem? I'm running revolution 2.2.10-pl (traditional) on Godaddy server.
I've seen others having similiar issues here on the forums.
I think this didn't have anything todo with MODX, but with some server-settings.
Not sure.
In spite of what GoDaddy says, my money would be on a mod_security setting on the server.
That said, it would probably be better anyway to use a snippet with $modx->regClientStartupScript() or $modx->regClientScript(); You can either put the JS in a file, or include it directly in the function call (inside of script tags).
http://rtfm.modx.com/revolution/2.x/developing-in-modx/basic-development/snippets/adding-css-and-js-to-your-pages-through-snippets
You could also put the JS in a chunk (with script tags) and do something like this:
$modx->regClientStartupScript($modx->getChunk('chunkName'));
GoDaddy probably wouldn't like that either, though.