HTML Wont validate?

JavaScript and client side scripting.

Moderator: General Moderators

malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

HTML Wont validate?

Post by malcolmboston »

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Home Page | Buy Carhartt, 10Deep, Triumvir3, Garbege, Artful Dodger, Fjall Raven, Michiko Koshino Yen Jeans, Aem'Kei, 10Deep and more! | Red Square Clothing</title>
<meta name="Keywords" content="Carhartt, Artful Dodger, 10Deep, Fjall Raven, One True Saxon, Triumvir, Modern Amusement, Aem'Kei, EDWIN jeans, Michiko Koshino Yen Jeans, Ijin Material, Levi's Blue, Crokos and Castles, Rockwell, Pointer, Tretorn, Recon, Garbege, GoodenoughUK, Diamon Supply, 80s Casuals, Backhand, Baracuta, Tonite, Farah" />
<meta name="Description" content="Red Square Clothing offers unique brands such as Carhartt, Artful Dodger, 10Deep, Fjall Raven, One True Saxon, Triumvir, Modern Amusement, Michiko Koshino Yen Jeans, Ijin Material and many more." />
<meta name="ROBOTS" content="ALL" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="JavaScript" src="javascript.js"></script>
<script type="text/javascript" language="JavaScript" src="swfobject.js"></script>
<script type="text/javascript" language="JavaScript" src="flash.js"></script>
<script type="text/javascript" language="JavaScript" src="slideshow_news.js"></script>

<!--[if lte IE 6]>
        <link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]--> 
<noscript>
<meta http-equiv="Refresh" content="1;URL=http://www.redsquareclothing.co.uk/javascript.php" />
</noscript>
</head>
line 3 column 1 - Warning: <noscript> isn't allowed in <head> elements
line 17 column 1 - Warning: <meta> isn't allowed in <noscript> elements
I want to auto-redirect if JS is disabled, this works but produces invaild HTML, any ideas?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Maybe you could, alternatively, start them on the page without JS and use JS to redirect users to the page with JS.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

hmmm, im sure there must be a more elegant way but im having no success with google, anyone else got any ideas?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Maybe you should program the entire page the correct way so that users without JavaScript can still use it. Usability, my friend.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

0.4% of users in the last 6 months have JS disabled, im not going to recode large portions of a very complex eCommerce application for such a small user base. In a perfect world i would allow anyone, with any hardware / software combination to view it, however in the real world this is not always the case and the other 99.6% get a better experience from the site because of it.

I asked a simple question, i would like to know if it can be done not whether or not it should be done.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

And as I believed I was implying in my last post, it shouldn't be done. No website should be so dependent of JavaScript that it cripples users without it. Usability means that it's usable, ideally by EVERYONE. Are you trying to redirect them to a page that says "You don't have JavaScript. You cannot use our website"? That's not good practice at all.

I'm sure most of your website features can be iterated without JavaScript unless it relies solely on AJAX (which is also bad for an entire website!).
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

jesus, how hard is it to get an answer.

Thanks SuperDesign for your reiteration of a point i have already said i am not bothered about, This is not some hobby web-site ive created for the sake of it, its a genuine business, with real world situations to think about, i am not in the slightest bit concerned for people who disable javascript or run a *10yr old browser* that simply isnt anything im interested in, how many sales are them 0.4% of people gonna bring me? none id guess.

Im also not interested in the "Usability" debate, i agree, but again, it is not important in this project.

I could keep ranting but i cant be bothered, can anyone answer this question please?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Well, if you're willing to ignore usability practices, then why care about valid HTML?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

because the 99.6% of visitors which i've already stated will enjoy a W3C Compliant web-site
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

And what does the W3C say about usability and accessibility?
User avatar
The Phoenix
Forum Contributor
Posts: 294
Joined: Fri Oct 06, 2006 8:12 pm

Post by The Phoenix »

Its a bit of a catch-22. You can't put meta refresh in the body tag, and you can't put noscript in the head tag.

Here is a close approximation:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Home Page | Buy Carhartt, 10Deep, Triumvir3, Garbege, Artful Dodger, Fjall Raven, Michiko Koshino Yen 

Jeans, Aem'Kei, 10Deep and more! | Red Square Clothing</title>
<meta name="Keywords" content="Carhartt, Artful Dodger, 10Deep, Fjall Raven, One True Saxon, Triumvir, 

Modern Amusement, Aem'Kei, EDWIN jeans, Michiko Koshino Yen Jeans, Ijin Material, Levi's Blue, Crokos and 

Castles, Rockwell, Pointer, Tretorn, Recon, Garbege, GoodenoughUK, Diamon Supply, 80s Casuals, Backhand, 

Baracuta, Tonite, Farah" />
<meta name="Description" content="Red Square Clothing offers unique brands such as Carhartt, Artful Dodger, 

10Deep, Fjall Raven, One True Saxon, Triumvir, Modern Amusement, Michiko Koshino Yen Jeans, Ijin Material 

and many more." />
<meta name="ROBOTS" content="ALL" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="flash.js"></script>
<script type="text/javascript" src="slideshow_news.js"></script>
<!--[if lte IE 6]>
        <link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head> 
<body>
<noscript>
<meta http-equiv="Refresh" content="1;URL=http://www.redsquareclothing.co.uk/javascript.php" />
</noscript>
<p>test</p>
</body>
</html>
Unfortunately, in xhtml, as far as I know, you can't do what you are trying to do. Perhaps in html strict, instead?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

well Sales are king, i have made numerous 'non-standard' decisions in the development and running of the site such as 1024*768 screen res minimium, JS required, pop-ups (non-ad) etc.

This is all purely for the improvement of visitor->sales.

When/if you have/ever developed and manage a complete eCommerce web-site completely from scratch you will find that you need to make key decisions like the ones ive mentioned to maximise the sales of your site, because without sales, you have no job, its all well and good developing 'non-profit' sites where you can do pretty much what you want and use your web-site as a 'glorifier' to your talents, i could of done it without JS obviously but as i will reiterate again, Sales are king.

Besides, i have, in my opinion, been quite good in regards to W3C, fully CSS driven web-site which is still certainly not the norm which believe me would of saved me hundreds of hours of work if id of just used tables, site works seamlessly in multi browsers (IE5+), PNG support etc etc etc.

Believe me, JS is the least of my worries, i couldnt give a <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> about the 0.6% when you do this sort of thing for a living you end up being multi-faceted, i am now pretty much an expert in SEO, Market Analysis, the list goes on.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

The Phoenix wrote:Its a bit of a catch-22. You can't put meta refresh in the body tag, and you can't put noscript in the head tag.

Here is a close approximation:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Home Page | Buy Carhartt, 10Deep, Triumvir3, Garbege, Artful Dodger, Fjall Raven, Michiko Koshino Yen 

Jeans, Aem'Kei, 10Deep and more! | Red Square Clothing</title>
<meta name="Keywords" content="Carhartt, Artful Dodger, 10Deep, Fjall Raven, One True Saxon, Triumvir, 

Modern Amusement, Aem'Kei, EDWIN jeans, Michiko Koshino Yen Jeans, Ijin Material, Levi's Blue, Crokos and 

Castles, Rockwell, Pointer, Tretorn, Recon, Garbege, GoodenoughUK, Diamon Supply, 80s Casuals, Backhand, 

Baracuta, Tonite, Farah" />
<meta name="Description" content="Red Square Clothing offers unique brands such as Carhartt, Artful Dodger, 

10Deep, Fjall Raven, One True Saxon, Triumvir, Modern Amusement, Michiko Koshino Yen Jeans, Ijin Material 

and many more." />
<meta name="ROBOTS" content="ALL" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript.js"></script>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="flash.js"></script>
<script type="text/javascript" src="slideshow_news.js"></script>
<!--[if lte IE 6]>
        <link href="ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head> 
<body>
<noscript>
<meta http-equiv="Refresh" content="1;URL=http://www.redsquareclothing.co.uk/javascript.php" />
</noscript>
<p>test</p>
</body>
</html>
Unfortunately, in xhtml, as far as I know, you can't do what you are trying to do. Perhaps in html strict, instead?
Hi Phoenix, thanks for looking into the problem.

is there any other method i could use to do this? maybe im looking to close to home......
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

malcolmboston wrote:When/if you have/ever developed and manage a complete eCommerce web-site completely from scratch you will find that you need to make key decisions like the ones ive mentioned to maximise the sales of your site, because without sales, you have no job, its all well and good developing 'non-profit' sites where you can do pretty much what you want and use your web-site as a 'glorifier' to your talents, i could of done it without JS obviously but as i will reiterate again, Sales are king.
Maximizing sales usually doesn't include turning potential customers away.


Like Phoenix said, try a different DOCTYPE, maybe. Maybe something looser. Use the W3C validator and go from type to type to see if any of them support what you're after.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Just use both...


put the javascript where it belongs, the meta refresh where it belongs and set the meta refresh to be one second longer than the javascript refresh.. that way before the meta has a chance to do it's job, the javascript has done it already, and if it's not there, the meta takes over...
Post Reply