Closed Bug 317768 Opened 20 years ago Closed 17 years ago

JavaScript backslash escaping error

Categories

(Tech Evangelism Graveyard :: English US, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ivarBZ, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 The page has the following code (at the end of the document) if (use_a == 1){document.write("<script language=\"javascript\" src=\"tempfiles/mapcoords_a.js\"></script>");} else{document.write("<script language=\"javascript\" src=\"tempfiles/mapcoords_b.js\"></script>"); } The Java console gives me this message Error: unterminated string literal Source File: http://bpfile2.asp4all.nl/indexauto.html Line: 214, Column: 31 Source Code: if (use_a == 1){document.write("<script language=\"javascript\" src=\"tempfiles/mapcoords_a.js\"> Reproducible: Always Steps to Reproduce: 1. open page Actual Results: no red lines show up (some code is printed at the top of the page) Expected Results: red lines (indicating traffic jams) should be shown on the page One of the other browsers (he who should not be named) makes it look easy. when i drag the page through the validator it gets almost crazy. is it an evangelism bug ?
Yes, it's a site problem: one shouldn't have a literal </script> within a script. Quoting it doesn't make any difference to the HTML parser (see bug 32618) The usual thing to do within JS code is to write it as <\/script>, which they have done elsewhere on the site.
I send them an email and made a working page, I only had to add the \ in <\/script> as you said.
Component: General → English US
Product: Firefox → Tech Evangelism
Assignee: nobody → english-us
QA Contact: general → english-us
I don't speak or read Dutch, but I'm pretty sure this site is dead, and therefore FIXED.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
OS: Windows 2000 → All
Hardware: PC → All
Resolution: --- → FIXED
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in before you can comment on or make changes to this bug.