In a site.com page I have an iframe and I want to access the vf page in this iframe. when I use the internel link of this vf page(https://cs2.salesforce.com/apex/page) as an iframe using site studio page (for testing purpose)and stay login to the org where this vf page is existing at that time it is working fine.

The exposed url(http://sample.force.com/calendar/apex/page) for that vf page is working in browser .

So now when I want to use this vf page as an iframe of a site.com studio page I am just using this exposed url in iframe but it is showing the blank iframe.

Not sure of how to implement this.

Thanks in advance

  • As Peter is saying, you need to use Force.com Sites and use that url. Make sure the "Clickjack Protection Level" setting on the Force.com Site is set to allow framing. – Kristian Aug 23 '14 at 4:58

You need to make sure that the iframe src attribute uses the Force.com Site URL and not the instance URL and you need to make sure that the URL is https. If you use http the browser will likely not load the iframe. If you view your browser's JavaScript console you'll see something like

[blocked] The page at 'https://sitestudio.na15.force.com/' was loaded over HTTPS, but ran insecure content from 'http://yoursite.com/test': this content should also be loaded over HTTPS.

This will not work (doesn't use Force.com site URL):

<iframe src="https://cs2.salesforce.com/apex/page" /> 

This will not work (not https):

<iframe src="http://yoursite.com/yoursite/page /> 

You can use the following. The browser will use the protocol of the current page which will be https in the studio and http when the page loads over http outside of the studio.

<iframe src="//yoursite.com/yoursite/page" />
  • How do I expose my site.com site over "https"? because [yoursite.com/yoursite/page] gives a warning while [yoursite.com/yoursite/page] works fine – Sagar Vadariya Aug 19 '14 at 10:35
  • 1
    You can use the leading "//" iframe src URL and it will work in the studio as https and work on your site as http. Using the leading "//" will instruct the browser to use the protocol of the page. – Peter Knolle Aug 19 '14 at 10:39
  • I tried using "//" but it takes up http instead of https even though the parent page URL is --sitepreview.na3.force.com/sample-- – Sagar Vadariya Aug 19 '14 at 10:42
  • Is there some specific setting to expose the Site.com site over HTTPS? – Sagar Vadariya Aug 19 '14 at 10:45
  • 1
    This is correct. I do the same thing with a VF page iframed inside of site.com. By using simply "//" and not specifying a scheme, the containing page will use its scheme in calling the iframe. – Tony Brasunas Aug 26 '14 at 17:53

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.