ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

javascript breaks template updates

December 29, 2010 2:16am

Subscribe [5]
  • #1 / Dec 29, 2010 2:16am

    pserko

    44 posts

    I have a javascript that I have been running on a website for years that is called with “document write “

    suddenly when I go to make changes in the template I get this error:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, .(JavaScript must be enabled to view this email address) and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    This script still works on the webpage.  When I remove the code in the template it updates without the code and no error message.  However, I have other templates in the same template group what will not allow any changes that does not include this code snippet or any other javascript.  If I delete all the content and the just add plain text it updates.  If I leave the existing code and make any changes it will throw the above error. 

    As an addendum: I just updated to 1.7 from 1.66, I noticed the problem in 1.66 that is why I updated.

    I can update other templates in other groups but when I add the javascript code noted above it errors.

    Very strange…  I need some help.

  • #2 / Dec 29, 2010 10:50am

    Sue Crocker

    26054 posts

    This really sounds like a case of mod_security.. I’ve seen that before. The solution is to check with your host to see if they can turn it off, or use an .htaccess file to turn it off.

    <IfModule mod_security.c>
        # Turn off mod_security filtering.
        SecFilterEngine Off
    
        # The below probably isn't needed, but better safe than sorry.
        SecFilterScanPOST Off
    </IfModule>

    NOTE: Take care in using this code in your .htaccess file.

    Does that help?

  • #3 / Dec 29, 2010 11:19am

    handyman

    509 posts

    In addition to what sue says, you might try calling this code from outside an EE template - from a regular JS file, or else even including it in full form in the final template (instead of calling it)....

    This may at least help you tell if there is a problem with the JS or if the problem lies elsewhere.

    The error which you received is very generic - I get it when even the slightest mistake is made in .htaccess or httpd.conf.
    Being generic, it is tough to trace exactly.

    There are also some various JS and web page checkers and validators floating around the internet. JS and other such languages and declarations often work but are still not compliant with some standard or another. Of course, this describes my entire web site! 

    One such tool is:
    http://jsbeautifier.org/

    I have not tested that one, but even the W3 validator and html tidy made some comments and fixed errors (or claimed to) in my hand written JS.

    Good luck….

    PS. Note that there are sometimes problems them HTMLtidy and JS…...
    http://javascript.about.com/library/bltidy.htm

    Let us know what you think eventually fixes this…...for posterity!

  • #4 / Dec 29, 2010 3:29pm

    Barry Cogan

    291 posts

    Handyman, thank you for chipping in 😊

    Hi Pserko,

    How are you getting on with Sue and handyman’s suggestions?

    Are things working out for you? Can we be of any further assistance?

  • #5 / Dec 29, 2010 5:33pm

    pserko

    44 posts

    I am working with tech support at my host.  Very odd, one minute the document write trips it the next it doesn’t. 

    I’ll let you know what happens, let’s hope it doesn’t spread to my other websites.

  • #6 / Dec 29, 2010 11:05pm

    John Henry Donovan

    12339 posts

    Thanks for the update pserko. Let us know how you get on.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases