Is it possible to invoke a visualforce page from another visualforce, without using apex controller?


Yes, if you use an action that resolves to a URL, you can redirect. Here's an example:

    <apex:commandButton value="Go to page 2" action="{!URLFOR($Page.page2)}" />

You can use this for any attribute that expects an action.


Yes, you can using client side redirection methods using window,location objects in javascript. Worst case - not advisable you can use anchor tags to redirect with relative urls

  • This does not work in Lightning. May 15 '17 at 18:58
  • Even after the locker service is enabled we can access the dom elements and window object using globalIds. For eg. , if we have a component and you need to redirect on load to some page , you can still use window.parent.location.href = 'xxxx', this will still work
    – freaker87
    May 15 '17 at 19:08

Thanks sfdcfox it worked.

Freaker87 proposed a solution using javascript. What is the best approach: using native SF VF tags or to use javascript? I think Javascript in VF is less save because it could expose (for example in the case of SF public sites) to the public internal links and code if we use browser developer console. Is it true what I'm saying?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.