", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A7QEqSAN", "datePublished": "2013-01-03T12:20:59.000Z", "author": { "@type": "Person", "name": "Sanjay mankani", "url": "https://trailblazers.salesforce.com/profileView?u=00530000006a9v1AAA", "affiliation": { "@type": "Organization", "name": "Techmatrixconsulting" } } } ] } }
Skip to main content
Hi, we have created one visualforce page having a registration form. After clicking on Save button it is redirecting to our Website's home page. Instead of redirecting it directly to the Website home page, I want it to redirect to one VF page (say Thankyou page). After getting redirected to the Thankyou page, the Thankyou page should contain the message like "Thank you for registering." and after a specific time interval (say 5 seconds) it shall be automatically redirected to our Website home page.

 

I got the something relevant for HTML on w3schools.com. But could not find anything for visualforce.

 

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_redirect

 

Will be grateful if I get assistance for this.

 

Thanks.
3 answers
  1. Jan 3, 2013, 12:20 PM
    Hi Satish,

     

    For redirecting to "ThankYou" page after clicking on Save button you have to make your save method to return a pageReference dataType. Then in that method you have to return like this :

     

    return new pageReference('/ThankYou');

     

    Then at "ThankYou" page for redirecting to "Home" page after 5 seconds you have to do javascript code something like this :

     

    <script>

    window.onload = window.setTimeout(redirect(),5000);

     

    function redirect(){

    window.location.href='/Home'; 

    }

     

    </script>
0/9000