Dave (cerealnumber) wrote,

Word Wrapping IE's Plain Text

If you view a plain text document in Internet Explorer 8, for instance the plain text version of Cory Doctorow's book Little Brother and press F12 to bring up the developer toolbar, you can see that IE simply takes the plain text, sticks it inside a <pre> tag, and renders it. This means that word wrapping isn't supplied and the only line breaks that appear are those in the document. However, since the text document is converted to HTML it means I can implement word wrap myself using a bookmarklet:

javascript:function ww() { var preTag = document.getElementsByTagName('pre')[0]; preTag.style.fontFamily="arial"; preTag.style.wordWrap='break-word'; }; ww();

After adding a favorite and setting the favorite's URL to the previous, I can view plain text documents, and select my Word Wrap favorite to apply word wrap and non-fixed width font.

Tags: browser, ie, technical, wordwrap
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded