Escaping javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Escaping javascript

Post by alex.barylski »

Or rather tricking the HTML parser to skip JS code...

Code: Select all

<script>
//<!--
  alert('Now the HTML parser shouldn't choke incase it doesn't understand <script>???');
//-->
</script>
Is this really nessecary? I assume that is what the technique above is doing?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

It was used for browsers that couldn't handle JavaScript. They basically no longer exist, so the method is beyond deprecated.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

superdezign wrote:It was used for browsers that couldn't handle JavaScript. They basically no longer exist, so the method is beyond deprecated.
Thats what I figured...except that with the Mobile devices is that really the case?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Hockey wrote:
superdezign wrote:It was used for browsers that couldn't handle JavaScript. They basically no longer exist, so the method is beyond deprecated.
Thats what I figured...except that with the Mobile devices is that really the case?
They don't run the JavaScript, but they are aware that it exists, so they ignore the <script> tags themselves. The commenting is for browsers that are pre-JavaScript age.
Post Reply