http://www.perlmonks.org?node_id=960509


in reply to Perl Website Fails on tablet

Not sure if it will make a difference but I notice on your page you have:
</head> <body> <!--[if IE]> <link rel='stylesheet' type='text/css' href='http://www.cfhs69.com/css +/ie.css'> <![endif--]>
Link tags should be within the <head> and the comment is not being closed properly, should be:
<!--[if IE]> <link rel='stylesheet' type='text/css' href='http://www.cfhs69.com/css +/ie.css'> <![endif]--> </head> <body>

Replies are listed 'Best First'.
Re^2: Perl Website Fails on tablet
by tobyink (Canon) on Mar 20, 2012 at 06:12 UTC

    It is indeed the improperly closed comment. Whether that comment appears in the <head> or <body> in this case does not actually matter one whit. Obviously <link> elements are supposed to be in the <head>, but in practice browsers do not care about them being in the <body>.

    The fact that this one does not end with "-->" though is the problem. Effectively, the comment does not end at all!

    The original asker claims that it "works fine on PCs and Macs in any browser [he has] tried". I'd suggest that he's probably not tried very many recent ones. Some older browsers will happen to have error correction algorithms built-in that might be able to cope with this page. However, newer ones are all converging on the "One True" HTML parsing algorithm that appears in the HTML5 specification, which treats the page in question as basically one big comment, starting on line 12 and ending on line 105.

    Using lwp-request (part of LWP) and html5debug (part of HTML::HTML5::Parser)...

    [tai@miranda (pts/3) ~]$ lwp-request http://www.cfhs69.com/cgi-bin/alumni001A.pl | html5debug --output=err
    sniffing:chardet [complicance: INFO; line: 1; column: 1]
    not HTML5 [complicance: MUST; line: 4; column: 0]
    charset label:matching [complicance: INFO; line: 9; column: 0]
    unclosed comment [complicance: MUST; line: 105; column: 7]
    
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

      Lord I am not worthy

      Thank you very much for investing this much effort on solving my problem. I made the change and now it works (as you knew it would)

      I will investigate LWP and html5debug and add them to my library of debug tools

Re^2: Perl Website Fails on tablet
by tonyb48 (Novice) on Mar 25, 2012 at 16:25 UTC

    Thank you for taking your time to work on my problem.

    That appears to be exactly the issue. I swapped "]" with "--". It seems like some browsers tolerate this error, while others treated all my content like a comment! I made the edit and now it works in my tablet.

    If we all had a second pair of eyes, maybe we would not miss these things....