You need to sign in to do that
Don't have an account?
Shravan Kumar 71
Open Link in the same window below button in VF page
I am looking for a solution where when I click on a button, the resulting page should open in the same window below the button. Below is my current VF page, right now the page is opening in a new tab.
<apex:page lightningStylesheets="true"> <style> body input.btn, body input.btnDisabled, body input.btnCancel { padding: 4px 3px; padding-left: 1rem; padding-right: 1rem; text-align: center; vertical-align: middle; justify-content: center; border: 1px solid #dddbda; transition: border .15s linear; background-color: #0070d2; border-color: #0070d2; /* color: #fff; */ width: 300px; height: 35px; } </style> <apex:form target="_self" > <center> <apex:commandButton id="one" value="Lead Page" oncomplete="openDashboard(this.id);" /> <apex:commandButton id="two" value="Account Page" oncomplete="openDashboard(this.id);"/> </center> <br/> </apex:form> <script type="text/javascript"> function openDashboard(clicked_id) { if(clicked_id.includes('one')){ window.open("Lead URL"); }else if(clicked_id.includes('two')){ window.open("Account URL"); } } </script>
I have gone through your problem please refer below code:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
I am looking at opening the page in the same window below the button. The above solution opens the page in the same window but I can't see the button. I have to go back if I want to click on other button.
Thanks,
Shravan