# Xhtml, which do you use with rails?

**URL:** <https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878>\
**Category:** Rails\
**Created:** [January 1, 2007, 12:35am UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878 "2007-01-01T00:35:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 12:35am UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/1 "2007-01-01T00:35:59Z")

</div>

hi, which version of xhtml (or html) do you use with rails? (1.0/1.1,  
strict, transitional, frame)

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 12:44am UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/2 "2007-01-01T00:44:14Z")

</div>

Hi, you can use XHTML 1.0/1.1 or HTML 4.01. It really depends on what  
browsers you’ll support and it’s different for everyone.

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 1:06am UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/3 "2007-01-01T01:06:18Z")

</div>

Nick,  
The use of rails doesn’t effect your doctypes.  
See this article for a clear explanation on the difference between  
strict vs. transitional doctypes and their proper uses:

> **[Transitional vs. Strict Markup](https://24ways.org/2005/transitional-vs-strict-markup)**
>
> Roger Johansson returns to first principles and considers the fundamental differences between Transitional and Strict DOCTYPEs, as well as some of the common mistakes made when dealing with each. A timely reminder of the fundamentals can never go...

Best,  
BJ Clark

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 1:20am UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/4 "2007-01-01T01:20:35Z")

</div>

Conrad T. wrote:

> Hi, you can use XHTML 1.0/1.1 or HTML 4.01. It really depends on what  
> browsers you’ll support and it’s different for everyone.
> 
> Good luck,
> 
> -Conrad

It’s a good question, i want to support many browsers as possible 🙂  
so xhtml 1.1 it’s gone because IE doesn’t support it  
Now is between xhtml 1.0 (served ad html…but in this case, which are  
the benefits to use xhtml?) or html 4.01

@BJ Clark: thanks

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/5 "2007-01-01T19:15:48Z")

</div>

Isak H. wrote:

> On 1/1/07, nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Now is between xhtml 1.0 (served ad html…but in this case, which are  
> > the benefits to use xhtml?)
> 
> Use a before\_filter in your application controller to set the headers  
> correctly.  
> Something like:
> 
> def set\_encoding  
> if request.env[“HTTP\_ACCEPT”] &&  
> request.env[“HTTP\_ACCEPT”].index(‘application/xhtml+xml’)  
> headers[“Content-Type”] = “application/xhtml+xml; charset=utf-8”  
> else  
> headers[“Content-Type”] = “text/html; charset=utf-8”  
> end  
> end

thanks 🙂  
I’ve also found this:  
[http://www.7nights.com/asterisk/test/test\_trans.htm](http://www.7nights.com/asterisk/test/test_trans.htm)  
[http://www.7nights.com/asterisk/test/test\_strict.htm](http://www.7nights.com/asterisk/test/test_strict.htm)  
with IE is ok, but wit firefox there is a little problem, so i don’t  
know if use strict instead of transitional ☹

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [January 1, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/xhtml-which-do-you-use-with-rails/80878/6 "2007-01-01T15:31:21Z")

</div>

On 1/1/07, nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Now is between xhtml 1.0 (served ad html…but in this case, which are  
> the benefits to use xhtml?)

Use a before\_filter in your application controller to set the headers  
correctly.  
Something like:

def set\_encoding  
if request.env[“HTTP\_ACCEPT”] &&  
request.env[“HTTP\_ACCEPT”].index(‘application/xhtml+xml’)  
headers[“Content-Type”] = “application/xhtml+xml; charset=utf-8”  
else  
headers[“Content-Type”] = “text/html; charset=utf-8”  
end  
end
