javascript - What happens when we close the script two times? -


this might silly question want clarify this. happens when close javascript 2 times.

<script type="text/javascript"> alert("hello"); </script> </script> 

i did not getting error.its closed script there wont execution no error trigger believe. create trouble under situation?

why asking insert </script> @ end of plugin user submits script. don't have go coding on validation if works fine without creating trouble

the browser treat extra, unexpected end tag. doesn't matter it's </script>, </link> or else allowed in same context.

most browers silently ignore such tags unless enable strict / xml mode. strict mode, should errors in console.

to wrap plugins supplied user, suggest strategy:

  • always wrap them in own tags (so can sure structure correct).

  • check string put between 2 tags <script, <script> , </script> , report error if find of them.

the idea here users should never use script tags in code , put them belong.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -