I am trying to make a project that involves redirecting to another website. I am having trouble doing that.
Here is my code
document.getElementById("ContinueToWeb").onclick = function () {
location.href = "google.com";
}
<html>
<head>
<!--Some code here-->
</head>
<body>
<!--Some code here-->
<button id="ContinueToWeb">Continue</button>
</body>
</html>
For some reason, it redirects from c:/folder/index.html to c:/folder/google.com even though I am telling it to go from c:/folder/index.html to google.com. Do you know what's happening?
You have to add the protocol for the link or else it defaults to what the site is using which is your local filesystem. Use https://www.google.com instead