Fixing wide text files in mobile Safari

If you look at a plain text file in Safari on an iPad or iPhone you'll see it gets word-wrapped. This is fine when faced with a lot of ordinary text, but if it's monospaced - tables, ASCII art or whatever, then it's a pain. Here's an example.

We'd like to be able to fix this, and we can:

  1. Make a new bookmark to this page on your iWhatever
  2. Select the text here and copy it:
  3. javascript:{p=document.getElementsByTagName("pre")[0].style;p.whiteSpace='pre';p.wordWrap='normal'}

    If you're having trouble selecting this try highlighting it and dragging to the space to the right

  4. Open your bookmarks, hit edit, and find the bookmark you just made
  5. Rename it as you like, and paste the text into the location field
  6. Visit your page, and then select the new bookmark

Tada!

Before
 
After