Tuesday, October 14, 2008

Blogger: Iframe Breaks Post Editor



Update, As of Dec 15, this issue seems to be fixed. If your editor gets stuck, try reloading the post again and click the Edit Html Button before the compose preview can finish loading. If you can't catch it, use the following.

As the previous post described, although advantageous for everyone, it can be rather frustrating to add embedded code or iframes to an individual post. I know javascript, html, and understand software development/testing and it still took me a day to figure out what was really going on when my code didn't work. Then I think of my poor friends who have a hard time typing, editing a simple blog, let alone trying to add some cool HTML code to it.. yikes. Isn't that what blogging is all about.. ease of use with the flexibility to expand?

Help my editor is broken!!

Using the HTML Editor, I finally got my blurbbit to work and I decided I better test it with the compose/wysiwyg editor mode that the rest of the world uses. Imagine my surprise (and horror) when a blank screen appeared. Subsequent clicks on both Edit Html and Preview caused nothing to happen. I even tried typing new lines. Blogger took them, said it saved them (without complaint) and yet they disappeared into thin air.. gone.. poof. What is really scary is that not a single noticeable error message appeared, it just seemed strange that I couldn't access the other features of the editor.

So here I am stuck!! I can't add new text OR code, and I can't edit the old stuff. Yikes!! Well luckily I use Firefox and it gives me helpful error messages (unlike IE).

If you see either

Error: uncaught exception: Permission denied to get property HTMLDocument.createElement or
Error: uncaught exception: Permission denied to set property HTMLDocument.designMode.

in the FF error console, you have a broken editor.. stop immediately before you make any edits. If you have made edits cut/paste them into a buffer/text document until you fix the editor and then re-paste them.

Well that sucks.. now what?

Make sure you edit posts containing iframes with Edit Html mode enabled to begin with. Luckily there is this workaround, but what amazes me is no one talks or complains about it. From the one post I found in the user group, they just remove the iframe code and keep going, forever giving up the benefits of adding code.

For some strange reason Blogger "remembers" that the editor was either in the Edit Html or Compose mode based on the LAST post you PUBLISHED (not edited and saved). The easiest solution is to open an existing post which doesn't have an iframe (or create a new post), select the Edit Html tab and publish it. THEN go re-edit the post which has the iframe. It will appear correctly and you can freely toggle between Compose and Edit Html modes depending on your comfort level. Just remember to toggle to Edit Html mode before you publish, (or you'll have to go through the workaround again next time).

More Editing Oddities

There is a global option under Settings - Basic - Show Compose Mode ... The problem is that you have to be in Edit Html mode before you disable this option. If you disable this after publishing a post in Compose Mode you'll be stuck in Compose Mode.. huh?? Go figure!! Of course this makes it even harder to get back to Edit Html mode, so that you can use the above work around to finally edit your blogs with Iframes.

Blogger in Draft

Note: I usually stay away from the latest and greatest, because as a developer I have to design my code to work for the lowest common denominator (usually an older version or any version running in IE). I was VERY interested to see if either of these issues were addressed in Blogger in Draft.

The good news is it seems that extra line breaks (especially those caused by textbox \\n characters) ARE handled better. However an Iframe still breaks the Compose/WYSIWYG editor, but the above workaround still works.

Now my question is.. how many people have thrown away perfectly good embedded code/iframe solutions because of these editor problems? When will iframes/gadgets/widets be easy to add to individual blog posts, where the complex or single view features really belong?

No comments: