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

2 Answers 2


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.

  • 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?
    – alejandro
    May 16, 2017 at 16:44

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, 2017 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, 2017 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .