Wednesday, June 8, 2011

SharePoint 2010 - Issues with Styles and Markup Styles drop downs in Rich Text Editor. Access is denied / 'undefined' is null or not an object - sp.ui.rte.js


Problem:

In the Rich Text Editor (CEWP / Page Content Area), when a user clicks on Markup Styles or Styles, the popups do not show up. A JS error shows up. (Access is denied / 'undefined' is null or not an object - sp.ui.rte.js)

Click inside a Rich Text Editor (CEWP or Page Content Field)



Click on Styles / Markup Styles



You will notice that the status bar reports a JS error.


Clicking on the error in status bar brings the below dialog:


Explanation:

I initially thought that the jQuery registration call or addThis script might be causing the issues and therefore tried removing jQuery references from Google and replaced them with local references, removed "Add This" widget, etc..

Finally it turned out to be that there are some empty CSS/JavaScript files in the master page that are causing the js error.

Resolution:

Make sure that there are no empty css files that are included in the master page.
Just add a comment like /* Styles */ in the CSS file
Check-In/Publish the CSS file and the error should disappear.

7 comments:

  1. Hi,

    I am also getting this problem.

    I get the error "Access is denied" when i use "AddThis" widget and Page Content Field.

    When I remove "AddThis" widget, I do not get javascript error.

    But when i use "AddThis" widget and Page Content Field, I still get the errorr.

    any suggestion, please give me

    Thanks

    ReplyDelete
  2. If your site is on https, make sure that you reference https version of addthis widget

    ReplyDelete
  3. This saved me - Thank You!

    ReplyDelete
  4. Thanks a bunch! Worked like a charm for me!

    ReplyDelete
  5. Thanks, this was exactly what the problem was. We have a specific css file included for dev, uat and production to help place settings for identifying the environment (i.e. colours etc). For production

    we do not need any as this is the standard and the other two environments are the ones required to have changes. We had left the css file empty and the production was the only system have this

    issue. We have now updated this to have the styles comment in it and immediately it works. Once again, thanks for your suggestions.

    ReplyDelete
  6. You da man! Your post helped me out. I was about to start the master page over. yikes!

    ReplyDelete