Hi,
I am getting Change this code to not perform client-side redirection based on user-controlled data.
error in the below snippet although I have added the condition for specific urls but still. it is saying at top.location that “this invocation is not safe; a malicious value can be used as argument”
Can u please help me with this?
<script type="text/javascript">
if (self === top) {
// will remove the styling
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else if (self.location.href.startsWith('https://dev.example.com/') || self.location.href.startsWith('https://qa.example.com/') || self.location.href.startsWith('https://abc.example.com/')) {
// allow only example.com and https
top.location = self.location.href;
}
</script>