1

I am getting cross-site Scripting: DOM critical issue. Please can anyone help with the alternateway of using document.write

<script>
document.write('<base href=“' + document.location + '” />');
</script>

1
  • You are using curly quotation marks in your example instead of the straight ASCII ones, " Commented Mar 2, 2021 at 5:40

1 Answer 1

0

You can use following to prevent DOM XSS:

<body>
<script>
document.body.innerHTML='<base href="' + encodeURI(document.location) + '" />';
</script>
</body>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.