Salesforce | Refresh the parent window automatically on closing the child window

|
| By Webner

On closing child popup window (on click of a button), we wanted to refresh the parent window automatically to check the updates.

We can refresh the parent window on closing the popup window by using javascript.

Syntax : This is sample javascript code of page loaded in popup:

<apex:page>
<script>
function closeWindow()
{
window.opener.location.href="/{here we give the id of the page to which we want to refresh}";
window.top.close();
}
</script>
<div>
<apex:commandButton value="Close This Window" onclick="closeWindow();"/>
</div>
</apex:page>

We can provide a button with label “close this window” button, on click of which we can call a javascript function closeWindow() which closes the current window and refreshes the parent window automatically.

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Salesforce customization, App development or any other software development assistance please contact us at salesforce@webners.com

Leave a Reply

Your email address will not be published. Required fields are marked *