Refresh Page using inline Visualforce Page

Refresh Page using inline Visualforce Page

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

Subscribe to Phanindra Mangipudi

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe