“`<!–<script>`” in <script> will break your front end

Lets say you have this string in a variable (case insensitive):

`etc etc etc<!– etc etc<scRipT> etc`

This will break any html tag after it.

Or lets say you divided that into some variables:

const first = `etc etc etc <!–`;
co…


This content originally appeared on DEV Community and was authored by Labnan

Lets say you have this string in a variable (case insensitive):

`etc etc etc<!-- etc etc<scRipT> etc`

This will break any html tag after it.

Or lets say you divided that into some variables:

const first = `etc etc etc <!--`;
const second = `anything`;
const third = `<script>`

This will also break the html page.

Therefore please carefully assign any string that contains

`<!--<script>` 

or similar into a variable, if it is inside <script> tag.

jsifddle Example

Feel free to ask any question related to this in the comments :)


This content originally appeared on DEV Community and was authored by Labnan


Print Share Comment Cite Upload Translate Updates
APA

Labnan | Sciencx (2021-11-21T07:21:43+00:00) “`<!–<script>`” in <script> will break your front end. Retrieved from https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/

MLA
" » “`<!–<script>`” in <script> will break your front end." Labnan | Sciencx - Sunday November 21, 2021, https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/
HARVARD
Labnan | Sciencx Sunday November 21, 2021 » “`<!–<script>`” in <script> will break your front end., viewed ,<https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/>
VANCOUVER
Labnan | Sciencx - » “`<!–<script>`” in <script> will break your front end. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/
CHICAGO
" » “`<!–<script>`” in <script> will break your front end." Labnan | Sciencx - Accessed . https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/
IEEE
" » “`<!–<script>`” in <script> will break your front end." Labnan | Sciencx [Online]. Available: https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/. [Accessed: ]
rf:citation
» “`<!–<script>`” in <script> will break your front end | Labnan | Sciencx | https://www.scien.cx/2021/11/21/script-in-script-will-break-your-front-end/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.