How to do do HtmlTextWriter.WriteAttribute with a single quote?

633 Views Asked by At

I'm writing a control to support HTML5 video. The type attribute has to specify the codec as well. Some examples show: type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'. When I'm writing the codec with the HtmlWriter, it flushes type="video/mp4; codecs="avc1.42E01E, mp4a.40.2"". So far so good, but my iPhone and iPad browsers refuse to work with the ".

I'm using a WriteAttribute. How can I accomplish the writing of single quoted attributes?

1

There are 1 best solutions below

2
On BEST ANSWER

I suggest you to do just the opposite: output the attribute in the HtmlWriter standard way (double quotes) and just embed your codecs option within a couple of single quotes. That should make the trick here.