Hans Rasmussen

info@hansrasmussen.com, +46 (0)723 207008

Hidden content is revealed when forwarding HTML e-mails

I’ve been involved in a project where we generate UI that have personlized content depending on scope. To speed up things we also rendered these UI components to send the same result embedded in an e-mail. The e-mail looks ok when you read it.

However, to my suprise, it seems like when you forward these e-mails in Outlook (version 2003 was the one) and Word is used as editor, some content that were hidden are suddenly displayed in the e-mail.

There are a couple of solutions to this:

Try to make conditional outputs instead of just hiding them if you have server side controls:
<div ID=”youruniqueid” style=”display:none” runat=”server”>
 Your content goes here
</div>

This element defaults to not display (however it is displayed if you forward such an element in an e-mail)
youruniqueid.InnerHtml =”"; // this line will server side remove the content

If you don’t have access to the element server side use either jQuery or javascript to clear the element data
jQuery:
$(“:hidden”).remove(); // this will also pick up visibility: hidden styles
or…
$(“div[style*='display:none']“).remove(); // this will only pick up div elements with display: none

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

*