Html And Xhtml - serving the right kind

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #11) by Saint_Michael on Sep 2 2006, 03:00 AM. (Line Breaks Removed)
I like to make a small correction IE 6 doesn't handle most xhtml you need ot have IE 7 since that browser is xhtml xml complient.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

Html And Xhtml - serving the right kind

bjrn
Right now I have a site, which I've made XHTML 1.0 Strict. I am sending it as application/xhtml+xml to browsers that say they can handle it, and as text/html to all other browsers. Anyway, I started thinking that I'd much rather send proper HTML 4.01 to browsers that don't understand XHTML instead of XHTML pretending to be HTML 4.01.

It's not really a problem with IE, because it is made to handle badly written sites, but who knows, some browser that can handle HTML, but not XHTML, may be (correctly) parsing
CODE
<p> Hello <br /> World </p>
as
CODE
<p> Hello <br>&gt; World </p>


So I was wondering: Is there anyone here who stores their content as XML perhaps (or anything else) and transforms it in some way (with XSLT or anything else)?

Any ideas of how I would go about generating an XHTML and a HTML version from one base format. Or perhaps transform XHTML into HTML?

 

 

 


Reply

Xedos
I don't get you.

Do you mean something like differrent pages displayed for diffrerent browers that can support them?

I think javascript can do that.

Reply

bjrn
Yeah. Internet Explorer doesn't understand XHTML, so I would like to have something that can convert XHTML to HTML (or similar). And then when a visitor comes to my site I check if their browser can handle XHTML, and if not, I show them the HTML page.

I can't do it with JavaScript though. Because if I am showing them the HTML page I am sending it with a text/html MIME type, but if I am sending the XHTML page I am not sending it as text, but as application/xhtml+xml (for lots of difficult reasons).

So I really need something server-side

Reply

BoSZ
QUOTE(bjrn @ Feb 8 2005, 10:12 PM)
Yeah. Internet Explorer doesn't understand XHTML,
*


bro with all my hate to Ie i have to say taht what you had said is far from the thruth

most browsers render Xhtml

Reply

8bit
Whats wrong with IE? I have to use it cause Mozilla won't come up.

Reply

bjrn
QUOTE(BoSZ @ Feb 8 2005, 11:28 PM)
bro with all my hate to Ie i have to say taht what you had said [that IE doesn't understand XHTML] is far from the thruth

No it doesn't. When IE sees XHTML it says: "Wow. I have no idea what this is, so I guess it must be HTML 4 or something like that".[1] So although it looks like it understands XHTML, it's really only treating XHTML as if it were badly written HTML. Furthermore it doesn't understand the mime type application/xhtml+xml (which XHTML should be sent as by the server). I must admit that I've been hearing rumours that IE under WinXP SP2 can handle XHTML properly-ish.

Anyway, I'm still looking for something to either convert XHTML 1.1 to HTML 4.01 or XML to XHTML 1.1 and HTML 4.01 or something like that.


[1] Actually, it's a bit more complex than that, when IE gets a document it checks the 250 bytes of the document to guess what kind of document it is. IE does this because it wants catch things which are being sent with the wrong mime type by wrongly/uncarefully configured servers. IE doesn't really trust MIME types, it wants to decide for itself. So say you have a text document, full with HTML tags, but you want to show it as plain text. So, you think that sending it as text/plain would do it, but it doesn't. IE looks through the document, sees the tags and thinks "hah! the sever must have made a mistake" and shows the document as a HTML document, and not as a text document as you wanted it.

 

 

 


Reply

Roly
I do what you do, send the MINE type application/xhtml+xml to browsers who support it but I've never had your problem. Or I've never noticed it before o_O

Reply

Taupe
Yes, bjnr is right : IE doesn't support XHTML.

You might want to have a look to this script.

Reply

RGPHNX
So whats the definitive last word? Does IE handle XHTML -NO? If not, is there a script format/language converter program to solve this problem. That was the original question, I believe. Anybody know ? the second question was, For multi webbrowser compatibility is there a server side app. that solves this problem?
Anybody know??
RGPHNX

Reply

bjrn
This PHP script is what I am using right now for MIME types:
CODE

if (stristr($_SERVER['HTTP_ACCEPT'], "application/xhtml+xml")) {
 header("Content-Type: application/xhtml+xml; charset=utf-8");
} else {
 header("Content-Type: text/html; charset=utf-8");
}

So I am sending my pages as application/xhtml+xml to those browsers that claim to understand it. I guess I should do another check because browsers are technically allowed to send along a "quality" parameter to indicate how well they support a format. So a browser could send something like "application/xhtml+xml q=0.1" (not quite sure about the format) in the accept header, indicating that it only supports it to a very small degree. It's a minor point though.


But what I really want is to not just send XHTML as text/html and pretend it's HTML. I actually want to transform my pages for browsers that don't understand XHTML. I'm considering saving my pages in XHTML 1.1 and then having a regex run through it to convert it to HTML 4.01 for older browsers.


Edit: Just started reading the page Taupe linked to. It's looking just like what I was looking for, thanks Taupe smile.gif

Reply

Latest Entries

Saint_Michael
I like to make a small correction IE 6 doesn't handle most xhtml you need ot have IE 7 since that browser is xhtml xml complient.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2
Recent Queries:-
  1. your html cannot be accepted: tag is not allowed: - 900.03 hr back. (1)
Similar Topics

Keywords : html, xhtml, serving, kind

  1. What's The Point Of Xhtml?
    (3)
  2. Some Questions On Html
    (6)
    I was just curious on how people here learned HTML or XML (assuming you did, which, judging by the
    fact you are actually here on this board). How long did it take for you to learn the basics of HTML?
    How proficient are you right now in HTML? Which resources did you use when you were learning HTML
    (or are currently learning HTML?). How did you find learning HTML? Thanks.....
  3. Help Making A Web Adress Bar Using Html/js
    (9)
    Hey I need to make an adress bar basically you imput into the field press enter and your away but it
    cant use php or any code that needs to be installed, its all part of a workaround for my school
    interenet!....
  4. Html Ascii Codes - A Complete List
    downloadable php file (3)
    I was often frustrated at how, despite there being thousands of ASCII "special characters" such as
    &8659; , websites that claimed to list them all only listed the first 256. To combat this issue,
    I have created a table which lists the first 10,001 - from &#000; to &10000; I am sure
    there are many more but it is simply not feasible to create a table with many more rows as viewing
    it would put terrific strain on the browser.! You can download the file in two forms. One uses
    PHP to dynamically create the table (1KB), the other has it ready-made in pure HT....
  5. Html Div Help [resolved]
    help with the divs in ipb (1)
    hey guys, as you may know, i have ipb 2.3.4 set up on my site. i am currently using the centura
    skin and like it a lot. i have customised the header bar in terms of the logo, however also want a
    slab of text linking to the forums home at the top of the banner. i have so far managed to achieve
    this to work in firefox (see attached screenshot), however it just screws up in ie, opera and safari
    (i think). the link is here here is the code, both html and css, of the ipb header, and i have
    placed between stars the parts i have edited: CODE the css (only the ed....
  6. Opening Hyperlink In New Window Using Xhtml 1.0 Strict
    (5)
    My website (currently under construction) is all going well until I realized that the XHTML 1.0
    Strict DTD does not allow the target="_blank" attribute. How would I find a way around this? I'm
    used to using XHTML 1.0 Transitional, but I want this website to be Strict for a change. I would
    really like it if someone here at trap17 can give me some css that allows them to be opened in a new
    window. I have searched on Google and only found ways that include writing my own DTD (which I
    don't want to do), use javascript, and use another doctype. All of those things, ....
  7. Best Way To Protect Html Form Fields
    Looking for suggestions on how to protect form fields during user inpu (3)
    My working example is here http://sonesay.trap17.com/application.php The form submits to itself
    and stores what ever the user inputs into session variables. Thats all fine and I have validation
    checks for it, I wanted to add more and I remember comming across a site where they would lock from
    fields to prevent any changes if the information was already supplied and validated. I'm looking
    to build something similar but cant seem to figure out how to get that same effect at this time.
    Heres my program logic so far application.php includes('application_content.....
  8. Html Application Form
    (6)
    does anyone know how to make a form/application that when you submit the form with the submit but it
    sends it in a email to you email address if anyone on here knows please please let me know thanks, i
    want this so i can have members apply for a team on my football site and there information will come
    back to me and i can accept or reject them for that job....
  9. Login In Using Html
    (12)
    I have looked around and I can't find any code to help me out. I want to make it so you can log
    in to my site to get member featues. Could some one please help me....
  10. Wanna Learn Html From Scratch
    downloade an online tutorial,formatted my c: lost it forever,and FORGO (5)
    id prefer something i can download .....coz my internet connection is highly intermittant Moved
    from the Java section to the HTML section. ....
  11. Xhtml Strict Links Tip
    A problem might accure (5)
    If you try to put a link that has an & in your xHTML strict page, you need to change & to & in
    order for the page to be xHTML Strict.. eg.. BAD LINK: CODE
    http://jasamza.korisnik.com/forums/viewtopic.php?f=19&t=7&sid=6c2e9120dcff6e0b83698c4aa7be929a
    GOOD LINK: CODE
    http://jasamza.korisnik.com/forums/viewtopic.php?f=19&t=7&sid=6c2e9120dcff6e0b83698c4aa7
    be929a copy pasted &....
  12. Questions About Xml, Xhtml
    (3)
    Hi, I like to know briefly about XML , XHTML and can be they be in replacement of MYSQL/MYSQL for
    data storage?....
  13. Help With Css/html Layout
    Horizontal List Problems (5)
    I can't figure out why this horizontal list isnt working. Underneath my banner is supposed to
    be a green gradient bar with a list of links in the center of the page. The links are all the way
    to the left and are really small. The banner is also overlapping the list for some reason. This is
    my current layout(don't worry, I'm not trying to advertise).
    http://www.stormgaming.net/stormcreations/ This is my CSS file
    http://www.stormgaming.net/stormcreations/storm.css Thanks in advance for any help.....
  14. Html Help
    (6)
    ok so i need help again i was wondering how i can make a navigation bar that looks like this
    Free Website Templates <!-- Start of Page Menu -->
    Information Slide Show Pictures title="Time Line"> Time
    Line <!-- End of Page Menu --> Im having a problem putting
    the names of things that i want to go in those four boxes i tried to put in names but it didnt show
    up so i was wondering if anyone could give me some help....
  15. Some More Help With Html
    (2)
    Ok so yet again i need some help i have this so far: CODE <html> <head>
    </head> <BODY BGCOLOR="black" TEXT="white" LINK=#XXXXXX
    VLINK=#XXXXXX> <body> <center><h1> Pearl
    Harbor</h1></center> <hr> <p> <a
    href="http://photobucket.com" target="_blank"><img
    src="http://i173.photobucket.com/albums/w59/tuhyd/pearlharbor.jpg" border="0"
    align=right alt="USS Arizona "></a></right> <a ....
  16. Ok Background Help Please
    html (4)
    OK so i've given up on the paint for background now how would i get it to look like this
    http://img.photobucket.com/albums/v614/Dj1.../background.jpg without using paint and without it
    coming out to look like this... http://img.photobucket.com/albums/v614/Dj169211/Damn.jpg like,
    with just html code, not trying to use paint and do the BS any ideas?....
  17. Create A Xhtml, Css3 Valid Gallery With Javascript ;part 1
    (0)
    What were making In this tutorial, we will be creating a web page that can be used for a gallery, an
    easy way of showing your portfolio of works or photography, etc. The page will be coded in XHTML
    1.0 Strict and CSS3 valid, our CSS won't even have any warnings on them apart from one. So the
    first thing we need to do is set up a base structure for the XHTML. Below is the code for this.
    HTML html xmlns =" http://www.w3.org/1999/xhtml "> head > meta http-equiv ="
    Content-Type " content=" text/html; charset=iso-8859-1 " /> title >XHTML & CSS Galler....
  18. Help With Html
    (11)
    Ok so i just started learn html about a couple of weeks ago and i make a background image using this
    code: CODE <style type="text/css"> body {
    background-image:url("http://img.photobucket.com/albums/w59/tuhyd/backgrounds.jpg
    4;); background-repeat: no-repeat}</style> and i am having trouble putting my
    text on the top in the center becasue my links are on the left every time i try and move the text up
    it moves the links down and separates them and i don't know what to do. added code tags.
    please use appropri....
  19. How To Display Php Code [resolved]
    Html Help With Php Codebox (8)
    I'm trying to make codebox for my guestbook so that users can post PHP code inside.. I tried
    many versions but none of them works If i use , or i can display HTML code, but when i try to
    write PHP code it executes it does not display.. There is a way to make swap for You have codebox
    in forum to display php how can i make that?! thanks....
  20. Html Query
    HTML Query (2)
    OK, so I want to know if it's possible to have my links as a seperate file and simply reference
    that file in the rest of my site's pages so that if I change the links, I don't have to go
    and edit every single page of my site. Does anyone know how to do this?....
  21. Wml / Xhtml ?
    for wap (6)
    wml/xhtml who gvs more facilities to make a wap-community site?....
  22. Having Html Troubles......
    Please help! (1)
    I'm having troubles with the background colours on the HTML pages on my site
    keri-j.trap17.com Basically, the colors are hex codes and i'm no HTML n00b, god no! But, I
    just can't figure this one out! I have the background colour in the body tag (duh) " " on
    all my pages but on some of them the background is white. This might be to do with some javascript i
    have recently edited in each page or certain errors but whatever it is i can't figure it
    out! This is my homepage with the correct background color This is my poetry page with the
    fau....
  23. Wanting To Touch Up/learn My Html Again
    (27)
    Ok, well recently i realized that i am not as skilled in HTML (such as building website layouts) as
    i want to be, with tables etc... and so i was thinking about going through many many many many many
    many sites and just touching up on my HTML and see if i can code my own website template before
    starting to learn PHP because that is what i want to do. so, i am asking all of you experianced
    people on trap17 what websites did you use to learn your HTML skills, yees i know i could go to
    google and type in learn html or somthing along the lines of that, but i want to know wh....
  24. Creating Link In Html - Help Me With This!
    (5)
    edit: Neeeaavverrrminddd..... I was a total noob at php when i posted this and I needed help doing
    something with bbcode in php and didn't really know what I was saying.. /blush.gif"
    style="vertical-align:middle" emoid=":blush:" border="0" alt="blush.gif" /> Anyway topic
    resolved.......
  25. Html Question Concerning Pre Tag And Code Tag
    (8)
    My question is, why would anyone use the CODE tag when you can use the PRE tag? 1. The PRE tag
    recognises white space, the CODE tag does not. 2. The CODE tag requires that you escape some
    chars, the PRE tag does not. I cannot see anything that the CODE tag achieves that is special apart
    from sounding as though it is perfect for displaying code which IMO it is not. Thanks. ....
  26. Html And Javascript
    Not php as first indicated... (12)
    Edit your ScrollBar colors Change "Your color", to color code, that u need. CODE <STYLE
    type="text/css"> <!-- BODY { scrollbar-face-color: Your color;
    scrollbar-highlight-color: Your color; scrollbar-3dlight-color: Your color;
    scrollbar-darkshadow-color: Your color; scrollbar-shadow-color: Your color;
    scrollbar-arrow-color: Your color; scrollbar-track-color: Your color; } -->
    </STYLE> Insert Date Place this code between , tags CODE <script
    language=Javascript> <!-- v....
  27. Do You Know Html?
    Just Wondering, most of you would know. (65)
    Well I was just wondering, i know this polol might sound stupid, as this is a hosting site forum and
    the chances are you do know HTML, but the other day i met 2 people who didt have a clue what HTML
    was, and was just at the forum because they found this forum active. And also do you know any other
    programming languages, just wondering. I myself know HTML, C++ kinda, and learing PHP. Talking about
    Languages I know Tamil, English, Lote /tongue.gif' border='0' style='vertical-align:middle'
    alt='tongue.gif' /> .....
  28. Html Editor
    non WYSIWYG (19)
    What editor can I download and use that isn't a WYSIWYG(what-you-see-is-what-you-get) and is
    free. Currently I use NotePad but I want something better.....
  29. Html Cool Codes?
    (6)
    hey guys..whats up..well i ws just wondering if you guys have any cool codes for myspace or
    something..you know to design a page using html/css codes...see i tried googling around but all the
    sites had the same thing..they dont have a unique one...i want like games in my page...like my
    friend he had like tetris in his page..and i want a game// or anything like that to make my page
    cool /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' />
    anybody????plz...PEAcE!....
  30. where did you learn html from?
    (89)
    HI, i am intresting in knowing where you began learning html of what inspired you to start learning
    html. which programs did you use or which progs dyu use?....

    1. Looking for html, xhtml, serving, kind

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for html, xhtml, serving, kind

*MORE FROM TRAP17.COM*
advertisement



Html And Xhtml - serving the right kind



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE