So this is the function redirectuser() is capable of redirecting user from one one webpage to another or redirecting user from one website to another. In the above example I am redirection user to google.com.
Now it’s up to you where you will call this custom function. I am going to call this function over button's onClick event. Let's have a look over how to do this.
<input type="button" value="redirect" onclick="redirectuser();">