Refresh Page using inline Visualforce Page

Visualforce Aug 16, 2015

Following post explains how to refresh page using javascirpt in Visualforce Pages

Code Snippet:

function refreshPage(){
      // if you want to refresh from 'inline Vf' page below statement works
      window.top.location.href = '/' + redirectUrl
      // if you want to refresh from Vf page below statement works
      window.location.href = '/'+redirectUrl
}

NOTE: Please use any one of the above statements but not both because one can invoke an action either form Inline/Standard page but not both

Use Cases:

Events like onClick, onComplete

...
...
<apex:commandButton action="{!dummyAction}" onComplete="refreshPage();" />
...
...

Invoking under <script> tags under HTML / Visualforce Tags

...
...
<script>
    if(condition is true){
          // invoke following
          window.top.location.href = '/' + redirectUrl // works for inline Vf
          // if you want to refresh from Vf page below statement works
          window.location.href = '/'+redirectUrl
    }
</script>

Feel free to comment, if you need any help

Phanindra Mangipudi

Salesforce, Lightning Web Componets, Node.Js, Angular 2+, Bootstrap