We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37165
    • 89 Posts
    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.
      • 4172
      • 5,888 Posts
      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.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37165
        • 89 Posts
        Quote from: Bruno17 at Jan 07, 2014, 02:11 PM
        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.

        Just got off the phone with go daddy. They said it was not something on their side. Insisted that it was a modx issue... any ideas
          • 3749
          • 24,544 Posts
          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.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting