How to prevent XSS attack on selected window.location in javascript

This is my code where i have a userId in a method SwitchUser_Click. I need to prevent or somehow encode the return value from the switchUser_Click as it includes the UserId of a user vulnerable to XSS attack or redirects.
function SwitchU… Continue reading How to prevent XSS attack on selected window.location in javascript

Weather Channel, Shopify, & SAC – Hack Naked News #221

    This week, SUPRA Smart TV flaw lets attackers hijack screens with no video, 20,000 Linksys routers leak historic record of every device ever connected, a new attack creates ghost taps on Android smartphones, and an Australian teenager that hacked i… Continue reading Weather Channel, Shopify, & SAC – Hack Naked News #221