views:

88

answers:

1

I realise browser detection is not generally a good idea, however as each browser has a different implementation of contenteditable, I need a way to separate out my fixes for each.

Specifically:

gecko and webkit require a <br /> to be inserted at the end of empty paragraphs, otherwise they are automatically deleted.

ie and opera treat this <br /> as an ordinary <br /> and insert a newline.

I need a way to tell which browser or at least which of the implementations to use.

Please could you help me to find a method?

Thanks, Nico

A: 

Actually, I decided to go with quite an interesting solution to this: Use css browser prefixes to detect the browser.

for instance if(elem.style["MozBorderRadius"] != undefined) targets firefox1+ and the same can be done with WebkitBorderRadius.

Nico Burns