Javascript Syntax Error With Sequence "<%...%>" in Internet Explorer Only -
I define two tokens in javascript that contain arbitrary characters (generated by a server side script)
If the token1 sequence and token2 sequence %> , the Internet is meant to be included, the explorer says that there is a syntax error in the line token 1 - but only if each variable has its & lt; Script & gt; is defined in the block.
For example, this is OK:
xxxxxx ";> but it is invalid:
& lt; script Type = "text / javascript"> Var token 1 = "xxxx Var token 2 = " X% "> xxxxxx"; & Lt; / Script & gt; Both methods have been reported as valid markup in Firefox using the HTML validator extension, and errors are not reported in the error console.
In addition to this, I have noticed that I solved this problem by encoding the percentage signaling for these digits as \ 045 or \ x25 I can, or if I split the strings before and after the percent sign accordingly:
var token 1 = "xxxx But I welcome some feedback on why this is happening to protect against accidental errors.
Thank you.
>
Comments
Post a Comment