We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34926
    • 87 Posts
    I just had a similar issue and was using this:

    if($modx->event->name == 'OnWebPagePrerender' AND $mime_in !== $mime_out)
    {
            $modx->resource->ContentType->set('mime_type', $mime_out);
    }


    This was causing other plugins that added CSS, JS etc to break as the content type isn't correct if your plugin isn't fired before the rest. Changing to OnLoadWebDocument seems to have done the trick.

    Thanks smiley
      • 3749
      • 24,544 Posts
      Looking at the code, it looks like MODX grabs the content type just after OnWebPageInit, but I think Susan's suggestion looks to be the most likely: OnLoadWebDocument. That fires just before rendering the output starts.

      It looks to me like MODX is using the 'contentType' field rather then 'content_type'.

        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