First of all I dont think dev.to is the right place for solving your programming issues.
There are places much more suitable for this.
Secondly you are doing it wrong.
You should provide the onClick event listener a correct event handler, a function. Then encapsulate inside this event handler function whatever logic you want to do. Either return a value from this function or if directly inside the function re-assign url using window.location.assign to whatever value you need to set there.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
First of all I dont think dev.to is the right place for solving your programming issues.
There are places much more suitable for this.
Secondly you are doing it wrong.
You should provide the onClick event listener a correct event handler, a function. Then encapsulate inside this event handler function whatever logic you want to do. Either return a value from this function or if directly inside the function re-assign url using window.location.assign to whatever value you need to set there.