Visualforce page that calls another Visualforce page upon confirming from javascript.
Visualforce Page:
<apex:page standardController="Account"> <apex:form> <apex:pageBlock> <apex:commandButton value="Open VF Page" onclick="OpenVFPage()"/> </apex:pageBlock> <script> function OpenVFPage(){ var isConfirm = confirm('Do you want to open a new Visualforce Page?'); if(isConfirm) window.open('/apex/YourVisualForcePage'); } </script> </apex:form> </apex:page>
Similarly, if you want to open a visualforce page from a custom button using javascript then use following piece of code.
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} var isConfirm = confirm('Do you want to open new Visualforce Page?'); if(isConfirm){ window.parent.location.href="/apex/YourVisualforcePage"; }