How can I programmatically get all of a string's unicode entities to resolve themselves?
问题 I'm trying to mitigate XSS. How can I shield from this: jAvascript:alert('test2') in the href of a link? I've tried the following, but it just assigns the literal, unresolved value of that above string as a relative path of the href, not a proper javascript: href capable of triggering code execution. I'm wondering how an attacker might be able to exploit this. I've tried the following: a = document.createElement('a'); and then both this: a.href = 'jAvascript:alert('test2')'; and this: