On 14/07/2011 13:05, Foskett, Mike wrote:

Hi Mike,

Thanks for the response.

<noscript> is illegal when placed in the <head> under  XHTML v1 strict.

Reports 3 errors:

1. <noscript> not allowed here.

2. document type doesn't allow <link> here.

3. end tag for "object" omitted - The killer failure as it refers to the </head> element.

I tried a full URI too but it made no difference.

While  the same in the body reports one error, does not allow <link> here.

Server-side languages cannot detect JavaScript on / off on initial page request.

Regards

Mike Foskett

http://webSemantics.co.uk/ <http://websemantics.co.uk/>

*From:*[email protected] [mailto:[email protected]] *On Behalf Of *Support
*Sent:* 14 July 2011 12:08
*To:* [email protected]
*Subject:* Re: [WSG] Breaking validation using noscript - Is there a solution?

On 14/07/2011 11:36, Foskett, Mike wrote:

Hi all,

Just finished a major update for Tesco's homepage.

http://www.tesco.com/

Tesco's are the UKs largest retailer and this page gets approximately 1 million hits a day.

The page has been speed tweaked as much as possible given IT / server restraints.

Unfortunately the page now fails W3C formal grammar validation.

Because the page as designed was a massive 1.4MB (previously 260 Kb - 330 Kb), JavaScript was used to fetch image upon demand rather than on-load or post-load.

This greatly reduced the impact on the servers (critical) and improved the initial page load speed.

Obviously a no JavaScript version was also required.

The image references cannot be in the standard CSS as IE loaded all the images, used or not:

                .noJS .imgRef {background:url(...)}

Will not work.

All the image references were placed into a separate CSS noJS.css and the link in a <noscript> and this is where the validation breaks.

Apparently <noscript> is illegal in the <head>, and a <noscript> containing a <link> is illegal in the body.

<noscript>

<link rel="stylesheet" href="/homepages/default/noJS.compressed.css" type="text/css" media="all" />

</noscript>

I went for placing it in the body so the noscript is legal but the link reference is not.

I can see no alternative, and wondered if any of the list members had a more valid solution?

Regards,

Mike Foskett

http://webSemantics.co.uk/ <http://websemantics.co.uk/>

------------------------------------------------------------------------

This is a confidential email. Tesco may monitor and record all emails. The views expressed in this email are those of the sender and not Tesco.

Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8 9SL
VAT Registration Number: GB 220 4302 31

*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected] <mailto:[email protected]>
*******************************************************************

Failing that, could you not implement php to check whether there JS is enabled, if not, it can echo the StyleSheet.


--
Mike Flanagan
CCO Telford Computer Doctor
http://www.telfordpc.co.uk
[email protected] <mailto:[email protected]>
0800 058 8914


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************
I can see why it would throw the error whilst in the body, as the <link> tag belongs in the <head> tag's. Could you not create a .css file for non-js that loaded onload, then if JS is detected, a seperate .css file is loaded?

--
Mike Flanagan
CCO Telford Computer Doctor
http://www.telfordpc.co.uk

[email protected]
0800 058 8914



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [email protected]
*******************************************************************

Reply via email to