5

My use case is a rewrite of the Standard Lightning Component "Visualforce" which lets you embed a Visualforce page on a Flexipage.

The reason for this rewrite is, that the Standard "Visualforce" component is simply not powerful enough, i.e. setting a fixed height in pixel (with a maximum of 600) is simple unacceptable for my use cases.

Now it's pretty simple to use an <iframe> in a Custom Lightning Component. The only thing missing then in the embedded VF Page is sforce.one - which is needed for several patterns.

How to get force.one on any Visualforce page?

  • If you are inside the SF1 container then you will get the sforce.one automatically .Any issue ? – Mohith Shrivastava Dec 29 '16 at 13:16
  • 1
    @MohithShrivastava : No, you won't get it automatically. You get that baby only, if you use the Standard "Visualforce" Lightning component - with all it's weaknesses. Using your own iframe instead, you'll loose it. – Uwe Heim Dec 29 '16 at 13:18
6

One method I found is to add the URL parameter isdtp=p1 at the end of the iframes src attribute. Having isdtp=p1 in the URL of any Visualforce page seems to enforce the presence of sforce.one.

I noticed, that the Standard "Visualforce" Component also adds sfdcIFrameHost=web and sfdcIFrameOrigin=https%3A%2F%2FYOUR_DOMAIN.lightning.force.com (YOUR_DOMAIN replaced with yours of course)

At this point I haven't reverse engineered what exactly they do, but I think it's a good idea to provide them both. At least they seem to do no harm to the VF-page. In case I'll find out more details, I'll extend this answer.

  • 1
    Just beware if you try to use private APIs like this, things will break in future releases. There is no contract or public commitment to keep this behavior. – Robert Sussland Dec 29 '16 at 16:11
  • @RobertSussland : agreed, but how to do it now the right way, if the Standard Visualforce Component is really not good enough for our current use-cases? Do you see any viable alternative other than to provide isdtp=p1 to an iframe to improve that today with the given public APIs? – Uwe Heim Dec 29 '16 at 20:18
  • 1
    There is not a secure way to do this right now, however I believe this use case is being addressed right now. In the mean time, please hold off on trying to hack a solution. – Robert Sussland Dec 29 '16 at 22:43

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.