Last active
May 8, 2022 13:55
-
-
Save dasoran/5008534 to your computer and use it in GitHub Desktop.
innerHTML を用いた A タグ生成コード。linkUrl が "><script>....</script> のようになっていた場合、任意の JavaScript の埋め込みが可能になってしまう。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildAtag(target, linkUrl, linkName) { | |
target.innerHTML = '<a href="' + linkUrl + '">' + | |
linkName + | |
'</a>'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment