I have been reading about xss and some questions have raised, but most of all I was wondering if there is a way to avoid it in the frontend?
Let's say my backend logic is not working properly and I have entered a field with value:
"name": "<script> alert('hello') </script>"
If we use the html tag <p>
to display the information it executes the javascript.
I have searched it and found the tag <xmp>
but it is marked as "Obsolete", but I didn't find any other way that is not obsolete to not execute the javascript. So is there any way to protect the end-user in the front end from executing malicious scripts even if we somehow allow the script to be injected in the database?