Shaun Mccran

My digital playground

28
M
A
Y
2009

Gmail incorrectly displaying email content

I was recently working on an email application where users are sent emails on an automatic basis from the main web platform. There are many pitfalls to bulk email sending, and one of the oldest is how the email content will actually render in the users email client. Usually this is simply a case of people turning off images, or active scripting so they lose the majority of the design and layout.

Often people will include a 'Click here to view this online' link at the top of the email as a substitute, as it's much easier to control the how the content of a web page displays than an email.

A new pitfall (for me!) is Gmail. I found that sending exactly the same content to a hotmail account and a Gmail account resulted in two different displays!

The email is a three column layout, with both of the side columns being coloured to provide a bordered edging. In Hotmail it displayed as designed and tested, but in Gmail the third column was gone, and the central column had lost its shape and was overlapping the right area!

I eventually tracked down the error to an extra set of ending tags:

view plain print about
1</td>
2</tr>    
3</tbody>
4</table>

I spent a few hours looking for them at this point, but couldn't find them anywhere. After backtracking and examining the rest of the email (it is made of several component blocks) I discovered that there was a small table layout error in the code. This was causing G mail to attempt to fix it itself! It was reading through the code and interpreting the error and trying to correct it. It was writing in the end tags above itself, so I was never going to find them in a template!

So one to note for the future, G mail is strict about the code it renders, and will happily rewrite anything it doesn't like.

28
M
A
Y
2009

Twitter follow - spamming

With the growing phenomenon that is Twitter (don't people remember it from 2004 when it wasn't cool?) There also seems to be a growing trend for random uninvited following. Its only Wednesday and I've had six uninvited 'followings' from people that I have never met, nor share any common associates.

I'm all for social networking – in its proper place, but if Twitter is attracting follow-spam then it's a slippery slope to being blocked altogether. I wonder if they have thought about the whole 'invitation-accept' handshake model of adding contacts that several other social networking sites use.

In the meantime if I don't know you....you're getting blocked.

19
M
A
Y
2009

Forcing different browser compatibility modes in IE 8

On of the platforms I work on recently started experiencing strange browsers errors. It took about 2 seconds to see that these were caused by IE 8 and its new method of rendering certain content.

In this case it was a lightbox effect that popped up on top of the screen, whilst greying out the surrounding 'under' elements. IE 8 didn't understand the positioning, so rendered the pop up content at the bottom of the screen, and happily greyed out the whole page.

Rather than re writing all the functionality to be IE compatible I thought I'd investigate the 'compatibility mode' options.

It seems that there are at least three compatibility mode options in IE 8.

Emulate IE7

view plain print about
1meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /
Actually be IE 7
view plain print about
1meta http-equiv="X-UA-Compatible" content="IE=7" /
Force IE 8 mode
view plain print about
1meta http-equiv="X-UA-Compatible" content="IE=8" /

This meta tag has to be the first thing under the tag, it MUST be first, otherwise it wont work.

I would recommend that you use the value IE=EmulateIE7 instead of IE=7. This is because IE=7 will force all pages to use IE7 compatibility mode including quirks pages. IE=EmulateIE7 will ensure quirks pages render in quirks mode and standards pages in IE7 mode.

Or you could add it into your server setup, here is where you do it in IIS.

12
M
A
Y
2009

Harnessing the built in functionality of your development language

Too often these days I am amazed at the lack of forethought that goes into harnessing the built in functionality of a platform. I am talking specifically about the code base here. I'm thinking from high level objects, down to single small functions.

Take a moment to step back and examine your code use. Was there a reason that you picked that language? I'm guessing that there would have been some sort of analysis of the technologies on offer, and you picked the one you currently have.

All too often people shoot off in random directions of development without really examining the functionality that a platform already provides.

My main field of development experience is coldFusion, so I'll use this as my example. An all too common example of this is the 'application.cfm', or 'application.cfc' file. This file is a directory level extender. IE any files in the same directory, or indeed sub directories will inherit properties set in it. This makes it ideal for things like user access, and session management, and general data persistence. In almost every custom built framework I have come across someone has decided that they would rather handle this is a different fashion. Now I'm not against writing custom code, far from it, but I think it is very important to know what your code base can already do - here's why:

  • Why write functionality again, when it is already there?
  • Its a standard function of the code base. Its generally going to be more efficient than anything your writing 'custom'
  • Depending on wether your open source or not, it will have generally been tested by a huge variety of developers, and software companies. Has your custom function?
  • Bringing in new staff, and contractors and introducing them to custom functionality is time consuming. Chances are they already know, or have at least heard of most of the in built platform functionality.

There are obviously exceptions to the rule, sometimes the intrinsic code simply does not do exactly what you want it to. So before you race off and write a huge error handler, or string replacement method, take a look around, you might find that it is in fact already under the hood.

_UNKNOWNTRANSLATION_ /