When I click GOOGLE1 button, the url is opened in a new window. But when GOOGLE2 is clicked, the page just refreshes. I'm missing something?
<apex:page >
<apex:form>
<apex:pageBlock>
<apex:pageBlockButtons>
<apex:commandButton value="GOOGLE1" onclick="window.open('https://google.com');"/>
<apex:commandButton value="GOOGLE2" onclick="ToGoogle();"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
<script>
function ToGoogle() {
window.location.href="https://google.com";
}
</script>
</apex:page>
Thanks in advance.