1

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

3 Answers 3

4

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

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

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

1

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

2
  • 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
0

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?

You must log in to answer this question.

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