1

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

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.

| improve this answer | |
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

| improve this answer | |
  • This does not work in Lightning. – IllusiveBrian 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
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?

| improve this answer | |

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.