Is there a way to open VF page in lightning experience using URL link?. I know we can use sforce.one.navigateToURL but in our case it would not work because The URL link is outside the salesforce.

Use case

  • We are sending an vf page link in the email some thing like <a href="https://na16.visual.force.com/apex/myTask"> Click Here</a>. this is working fine with classic but we are facing the issue if user is in lightning experience.


  • If user is in lightning experience then this URL link is not working as expected. It's open the VF page but without one.app container.

I have attached the screen short of both classic and lightning experience output.

If user is in classic then URL Link open below screen

enter image description here

If user is in lightning experience then URL Link open below screen

enter image description here

Expected output in lightning experience

enter image description here

Is there any way to get expected output?

  • 7
    In order to resolve this, we have an option.From the email link we redirect the user to a page which checks if the user is lightning enabled or classic, and if the user is lightning enabled, then we append the URL /one/one.app#/alohaRedirect/apex/vfPageName to our URL and use it to redirect to the required page. We just want to know if this is the ideal solution or there is some other option to this. Commented May 25, 2017 at 12:47
  • Could you please let me know how exactly you are doing this check? is it via Javascript or Controller?
    – Sid
    Commented Feb 16, 2018 at 9:59
  • @Sid it's via controller. Commented Jun 3, 2020 at 5:19
  • 1
    I guess the workaround provided by you in the comment above is the best solution even now. Or since its been 3 years already, maybe make users redirect only to lightning and not classic :)
    – Sid
    Commented Jun 4, 2020 at 6:11
  • Don't link "click here".
    – isherwood
    Commented Sep 25, 2020 at 20:40

1 Answer 1


I would recommend that you add conditional code at the top of your page that determines what environment the User is currently in, then either displays the page using the Lightning experience where it puts the page in a Lightning I-Frame or if the user is in Classic mode, directly displays it without the I-frame. See Sharing Visualforce Pages Between Classic and Lightning Experience which contains the code for how to do this.

  • 1
    Can you guide me how to displays the page using the Lightning experience by using this na16.visual.force.com/apex/myTask kind of URL or is there any way to generate lightning experience URL? for me it's not navigating to lightning UI. Commented Dec 23, 2016 at 4:50
  • How to put the vf page in a Lightning I-Frame ? Commented Dec 23, 2016 at 4:52
  • See the references in the same Module in the section under Exploring the Visualforce App Container. I suggest you go through the entire Module to find the answers to your questions.
    – crmprogdev
    Commented Dec 23, 2016 at 12:48
  • 1
    @crmprogdev, your link describes conditional behaviour/appearance, based on the current theme. I can't see any mention of adding the Lightning frame. In fact, it says "Lightning Experience is the parent context, and your Visualforce page is the child context. Children need to obey their parents." So I'll be surprised (but happy) if there's a way for users to arrive on the page, the page to detect Lightning Experience is enabled, instantiate the LEX Single Page Application and reparent itself inside of it. Can you elaborate?
    – frup42
    Commented Jan 6, 2017 at 10:16
  • @frup42 I can't find the line you quoted on the page I referenced. The parent context is unknown. The JS determines the context from which you can then dynamically use additional JS to initiate the LEX code, the Lightning Frame etc to wrap the VF page inside of.
    – crmprogdev
    Commented Jan 6, 2017 at 17:53

You must log in to answer this question.

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