+ Start a Discussion
Melissa BunchMelissa Bunch 

visualforce iframe code help


I am in no way a developer so I'm having a hard time getting a very simple iframe to work.
I created a custom Visual Force tab in my org to display this page and I just want it to display an outside URL.

This is what I was using and it looks like it's almost there, but it just won't populate the external page and I can't figure out why.

<apex:page showHeader="true">
    <apex:pageBlock >
      <apex:iframe src="https://www.website.com">

Does anyone see what is wrong/can let me know what to change?


Alain CabonAlain Cabon

1) Iframe or Web Tab content displays a blank page:

2) You can't use an iframe like that with an external URL since 2015.

3) But the documentation is not enough clear and there is still this example with: 
<apex:iframe src="http://www.salesforce.com" scrolling="true" id="theIframe"/> that doesn't work anymore in fact directly into a simple VFP.

4)  Another example is used with iFrame, where the passthrough is used to get it’s attributes.
<apex:page controller="testcontroller" docType="html-5.0" sidebar="false" showHeader="false">

But the last example which works doesn't use an external URL in the iframes. 
Steven NsubugaSteven Nsubuga
Tested a couple of scenarios, seems like it mostly depends on the target website, Google (https://www.google.com) for example, refuses and the error seen in the chrome tools is "Refused to display 'https://www.google.co.in/ in a frame because it set 'X-Frame-Options' to 'sameorigin'."
On the other hand, my local Ugandan newspaper website (http://www.monitor.co.ug/) does display, after I explicitly allow Chrome to "Load unsafe scripts" via a pop up.
User-added image
Could definitely use an official explanation from Salesforce.
Melissa BunchMelissa Bunch
Thanks guys, doesn't seem like there's really a solution here. I did see others mention there was a clickjacking setting in Setup that Salesforce directly has to disable that may free up my iframe to work, but not sure that we want to go that route.

Thanks again!