think tank forum

technology » xhtml and javascript

Chiken's avatar
14 years ago
link
Chiken
Don't Let Your Walls Down
so im making a web page with the xhtml extention and everything is fine, except that javascript's wont work.

now i guess my question is, is there a way to make them work within a web page with a .xhtml extension?
asemisldkfj's avatar
14 years ago
link
asemisldkfj
the law is no protection
are xhtml file extensions even supported? why not use an html file extension and just specify xhtml in the doctype or whatever?
Chiken's avatar
14 years ago
link
Chiken
Don't Let Your Walls Down
yeah thats what i've ended up doing.
lucas's avatar
14 years ago
link
lucas
i ❤ demo
did that solve the issue?
Chiken's avatar
14 years ago
link
Chiken
Don't Let Your Walls Down
yeah, changing the pages to html got the scripts working.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
Extensions matter little. You can name it .txt, .py, .shitface, or whatever. As long as you send a proper content type header ...
lucas's avatar
14 years ago
r5, link
lucas
i ❤ demo
indeed. for example:

lucas@www:~$ cat web/lucasreddinger-com/style.php
<?php

header('Content-Type: text/css; charset=utf-8');

?>
* {
    padding: 0 0 0 0;
    margin: 0 0 0 0;
}

body {
    background-color: white;
    font-family: Helvetica, Frutiger, Sans-Serif;
    font-size: 100%;
    line-height: 1.4em;
    color: black;
}

a {
    color: #000066;
}

img {
    border: 0;
    display: inline;
    vertical-align: text-bottom;
}

#container {
    padding: 40px;
    width: 600px;
    overflow: auto;
}

h1 {
    padding: 0 0 0.4em 0;
    font-size: 1.8em;
    border-bottom: 2px solid #ccc;
}

h2 {
    margin: 0.8em 0;
    font-size: 1.1em;
}

p {
    margin: 0.8em 0;
    font-size: 1em;
    clear: both;
}

h2#contact_left {
    float: left;
    width: 300px;
}

h2#contact_right {
    float: right;
    width: 300px;
}

p#cv {
    font-weight: bold;
}

div#dba {
    font-size: 0.9em;
    padding: 0.5em 0 0 0;
    border-top: 1px solid #ccc;
}

div#dba p {
    margin: 0 0;
    font-size: 0.9em;
    clear: both;
}

lucas@www:~$
Chiken's avatar
14 years ago
link
Chiken
Don't Let Your Walls Down
so im assuming it wasn't using the text/html content header type?

if i remember correctly doesn't xhtml use application/xhtml?
lucas's avatar
14 years ago
link
lucas
i ❤ demo
it depends on the configuration of your http daemon. you can set it to send a text/html header for filename.xhtml.
Carpetsmoker's avatar
14 years ago
link
Carpetsmoker
Martin
Yes, text/html is for html, not xhtml. Making xhtml and sending a text/html header kind of defeats the purpouse of xhtml.
The correct content type for xhtml is application/xhtml+xml
lucas's avatar
14 years ago
link
lucas
i ❤ demo
oh, right. i misunderstood the question.