0

I am trying to add a link to redirect from opportunity page to a vfp page. There are two pages one for classic and one for lightning. I want to add two links. If user is in classic mode one button will show and for lightning the other button will show. Is it possible with javascript or apex?

1 Answer 1

0

I would suggest using a Detail page button to redirect on your page. After creating your button you can edit the page layout and add your newly created button to both lightning and classic page layout enter image description here I think that for your use case 2 buttons are needed, one to redirect in lightning and one to redirect in classic.

Otherwise, if you want to have a conditional link with Javascript you can try something like(I have never tested this though, so I'm not sure it's working):

if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
     // Do something for Lightning Experience
} else {
    // Use classic Visualforce
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.