Rebuilding The Web

Articles, advocacy, discussion and debate about the many problems of the Web and the challenges of rebuilding it.

How do Web browsers perform when copying and pasting alternate text?

In HTML, an image is made up of visual and textual data (alternate text). Most Web browsers attempt to render alternate text when visual data is not available. However, only one browser currently uses alternate text when pasting images into other applications.

The test

Let's start with the following HTML document:

  1. <html>
  2. <head>
  3. <title>Alt text copy and paste test</title>
  4. </head>
  5. <body>
  6. <p>I <img src="heart.gif" alt="love" /> you!</p>
  7. <body>
  8. </html>

A Web browser will render the markup above like this:

Screen shot of a Web browser displaying 'I', followed by an icon of a heart, followed by 'you!'.

Now, in the browser, select and copy the same sentence containing the image and paste it into Notepad or another application that does not support images. The correct result should be:

Screen shot of Notepad containing text 'I love you!'.

Unfortunately, four out of the five top browsers will not use alternate text and give this incorrect result:

Screen shot of Notepad containing text 'I   you!'.

Browser test results

Firefox 3.6.3Passed
IE 8 & IE 9 Platform PreviewFailed
Chrome 5Failed
Safari 4.05Failed
Opera 10.53Failed

Public comments

1. Posted by Mark Vozzo
on Sunday 2010-06-13 at 03:02:45 PST

Thanks for doing this test.

Another test I'd like to see results for (that is a secondary test) would be the treatment of the "title" attribute for an image.

If you were to set the title attribute = "love", I wonder how the different browsers treat the title when copy-n-paste.

<p>I <img src="heart.gif" alt="love" title="Love" /> you!</p>

Give that a try in the different web browsers and see what happens, whether the "Love" (with the capital 'L') appears. Just a thought.


Comments are closed for this article.

Main menu