Well, if you encode the content so that any javascript that is not there executing, it should be safe.
If you do not, the user can download javascript, which will be executed the next time another user views this page.
I want to change my answer to take into account @Brigham's comments. Escape only works reliably if you are dealing with innerHTML of something like a div tab, if you are dealing with a user-generated value as an attribute or in a script tag, then escaping / encoding will not work.
I will tell you about the OWASP XSS guide (which @Brigham originally caught my attention) for more information: https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#Untrusted_Data
source share