Menu

Snippets

Yet another programmer blogging about code

Posts Tagged ‘html’

I thought title text improved accessibility. I was wrong.

Friday, February 15th, 2013

David Ball has written a follow-up to his excellent article “Things I learned by pretending to be blind for a week“, where he discusses why title text is not as useful as we’ve been led to believe, and what to do about it. Please, if you haven’t already, go and read his article: “I thought title text improved accessibility. I was wrong.

Safely encode dynamically-built HTML and JavaScript

Saturday, November 10th, 2012

If you build fragments of HTML and JavaScript dynamically from browser script, you need to take care to encode any special characters in your strings. Building your HTML using DOM createElement() and createTextNode() is often better, but sometimes the better solution is to generate a block of HTML. Here’s a couple of simple functions to do that, quickly. (more…)

Korpela’s guide to using special characters in HTML

Wednesday, February 1st, 2012

Here’s a gem that just has to be widely disseminated. Jukka Korpela has written a nice guide to using special characters in HTML. I reckon it covers the problem pretty comprehensively, so rather than try to write one myself, I reckon everyone should check out his guide.