Closed Bug 157084 Opened 24 years ago Closed 22 years ago

swchamber.co.uk - JavaScript console reports missing semicolon in comment field

Categories

(Tech Evangelism Graveyard :: English Other, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: mozilla.bugs, Unassigned)

References

()

Details

Attachments

(1 file)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.0.0) Gecko/20020530 BuildID: 2002053012 The javascript in the page at http://www.swchamber.co.uk doesn't execute. The javascript console reports the following error: Error: missing ; before statement Source File: http://www.swchamber.co.uk/ Line: 159, Column: 6 Source Code: hide JavaScript from non-JavaScript browsers This causes the page to display a message that the browser doesn't support W3C web standards (!!) I've tried the following: 1. Add a <!DOCTYPE line (as described on the Bugzilla page) - get same result. 2. In the 2nd SCRIPT block, move the comment to the same line as the <!-- tag. Java console now doesn't report an error, but the page still doesn't display. It works OK with IE (v. 5.00.2919.6307IS) on NT4.0. It doesn't work with Netscape 4.7 on a Mac. I complained to the web designers - this is what they said: ============================================================= Thanks for your note. The South West Chamber site is aimed at businesses throughout the South West and is made specifically to deal with main stream browsers. It is also designed to comply with W3 standards. Whilst not suggesting that Mozilla isnt W3 compliant it currently represents a proportion of 1.1% of all web browsers as outlined in the table below. May I suggest you view in IE 5+ for best results. Regards. Browser Type Market Share (%) MS IE 5.x 24.9 MS IE 4.x 44.7 MS IE 3.x 3.6 NN 4.x 22.0 NN 3.x 2.3 MS Web TV 1.4 Other 1.1 ================================================================= Reproducible: Always Steps to Reproduce: 1.Open page http://www.swchamber.co.uk 2. 3. Actual Results: Page displayed a message: Sorry your browser will not work with this web site because your browser does not support accepted web standards. Expected Results: Run the Javascript & displayed the page correctly. OS - Win NT4.0 SP6 Using "Modern" theme Javascript settings: Enabled for Navigator, disabled for Mail & Newsgroups "Allow webpages to:" - All checked except "Change status bar text" Cookies enabled for originating web site only Maximum lifetime limited to current session
The page has the following code: <script language="JavaScript"> <!-- hide JavaScript from non-JavaScript browsers the "hide JavaScript from non-JavaScript browsers" is treated as JS code by Mozilla, and it should indeed be, according to everything I understand. As you may imagine, this is not very valid JS code. Confirming to decide whether we want to treat the entire line following "<!--" as not part of the script or whether we want to evangelize the site. Just adding a "//" before the "hide" will fix this problem, as a note.
Status: UNCONFIRMED → NEW
Ever confirmed: true
According to HTML 4.01, section 18.3.2 "Hiding script data from user agents", The JavaScript engine allows the string "<!--" to occur at the start of a SCRIPT element, and ignores further characters until the end of the line. So if Mozilla doesn't handle that, it's a standards violation. --scole
Attached file testcase —
Not all is so simple; we pass this testcase. Investigating the problem with the site again.
Oh, I am a fool. The JS error is from line _159_ of the file. The script there is: <script language="JavaScript"> <!-- hide JavaScript from non-JavaScript browsers //--> </script> So the error is correct and irrelevant to the problem. The problem is the following browser-sniffing code on the site: // Netscape6 is mozilla/5 + Netscape6/6.0!!! // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0 var nav6Pos = agt.indexOf('netscape6'); if (nav6Pos !=-1) { is_minor = parseFloat(agt.substring(nav6Pos+10)) is_major = parseInt(is_minor) } (this will _not_ set is_minor and is_major in Mozilla, since it explicitly looks for Netscape6. It will break in Netscape7 too). Followed by: var is_nav6 = (is_nav && is_major==6); // new 010118 mhp var is_nav6up = (is_nav && is_minor >= 6) // new 010118 mhp Followed by: if (is_ie4up || is_nav6up || is_opera6up) {window.location=('index.asp');} So in Mozilla that window.location call is simply never executed because the site has arbitrarily decided that we don't support javascript or something. Over to evangelism. The site is already using object sniffing for getElementById, so I don't know why they're bothering with this useragent sniffing.. If they _do_ want to do it, they should sniff for "Gecko", not "Netscape6". Rob, further mail from you to them pointing out the situation may be helpful; mention the fact that you are using a Netscape 7.0 beta (which does not have "netscape6" in the useragent) and the site will not let you in. ;) Also mention that any browser that has "Gecko" in the useragent will be at least as good as Netscape 6.0 for their purposes (the ones that were not and had Gecko in the useragent are so horribly broken, no one really uses them).
Assignee: rogerl → nitot
Component: JavaScript Engine → Europe: West
Product: Browser → Tech Evangelism
QA Contact: pschwartau → brantgurganus2001
Version: other → unspecified
Oh, as a note, I loaded index.asp and browsed it for a bit... things seemed to work perfectly fine there.
I've passed on your comments. I'll let you know what they say. (Rob)
Hmm, the site still doesn't work...
Summary: javascript console reports missing ; in comment field → swchamber.co.uk - JavaScript console reports missing semicolon in comment field
tech evang june 2003 reorg
Assignee: nitot → english-other
Component: Europe: West → English Other
QA Contact: brantgurganus2001 → english-other
I just tried it - for whatever reason it works OK now. Perhaps they took notice? (Rob Bracken)
WFM
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: