I've made a mistake by creating a modal dialog in CEWP code without a Close button. Now I have no way of closing the modal and so cannot access the page or edit the code in web part.

I would of course copy the code but I can't get at it. Similar to this post: http://blog.solutions2share.net/2013/05/spuimodaldialogshowmodaldialog-do-not.html

I've tried:

  • I renamed the file ref'd in URL, but when I 'Edit Page' the dialog shows Page cannot be found.
  • I've downloaded the Home.aspx with the CEWP but cannot see any reference to it in the code.

Is it possible to run a command in Developer Tools to close it?

  • Would you want to remove the CEWP from the page it self
    – Asad Refai
    Aug 19, 2015 at 12:50
  • Open the page in designer and you could edit the CEWP code there or atleast remove the CEWP from the page
    – Unnie
    Aug 19, 2015 at 12:51
  • All, thanks, but you miss the obvious - I cannot edit the page because the dialog is in the way. Solution below. Aug 19, 2015 at 12:53

2 Answers 2


You can just add ?contents=1 to your url and then remove the content editor web part from there.

Then i would recommend to place your code in a txt file and link it to the CEWP instead, then you can just delete the txt file if you wanna get rid of whatever it does and there is no risk of breaking the page/site itself.

Which Webpart is that?


So, if you should find yourself doing such a silly thing as above, you can remove the dialog (it works in IE 11) by bringing up Developer Tools and entering the following in DOM Explorer command line at the bottom:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.