Is there a way to do this completely in JavaScript?
window.location.href = "https://www.duckduckgo.com"
You can find more info on the location.href method here.
location.href