function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mike1.3910160257587908E12mike1.3910160257587908E12 

Blank white page appears when trying to embed Iframe in Visualforce..

I can't quite find an error with my code. Someone suggested Salesforce doesn't allow Iframes anymore? Can anyone make any suggestinos or reccomendations to this code? I am just trying to get a VF page to display an Iframe of webcontent on the Account page layout. (Notice I have used a merge field to find the SRC of the website.)

<apex:page standardController="Account" sidebar="true" >
<apex:iframe frameborder="true" width="1000px" height="800px"
src="{!Account.urlfield__c}" scrolling="true"
id="EmployeeRefer"/>
</apex:page>
bob_buzzardbob_buzzard
You should be able to do this - I have a VF page with an iframe that is embedded into a record view and it works fine.

What is the URL that you are trying to iframe in?  Some servers will set the X-Frame-Options header:

https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options?redirectlocale=en-US&redirectslug=The_X-FRAME-OPTIONS_response_header

which stops the content being displayed in a frame.
mike1.3910160257587908E12mike1.3910160257587908E12
I tested a variety of URLs from Yahoo to Google and I could not get any of them to work.. 
bob_buzzardbob_buzzard
Yahoo and Google both set the X-Frame-Options header to explicitly stop you embedding them in an iframe, so this is expected behaviour.  

I've just tried with the Salesforce app home page and it worked okay  - try:

<apex:iframe src="/home/home.jsp"/>

and see what happens there.
mike1.3910160257587908E12mike1.3910160257587908E12
Yes that displays the home correctly. Should I just try and replace the merge field with "/home/home.jsp"
mike1.3910160257587908E12mike1.3910160257587908E12
Ok I replaced your line with this: <apex:iframe src="https://www.google.com"/>
and it just displays a blank page.
bob_buzzardbob_buzzard
That is the correct behaviour.  

As I said earlier, Google sets the X-Frame-Options header to explicitly stop you embedding the site in a frame.  There is nothing you can do about this - if the server sets that header your browser will not display the content.
mike1.3910160257587908E12mike1.3910160257587908E12
Dang that sucks! Well thanks for your help.
eshannon1.3924215214047554E12eshannon1.3924215214047554E12
I get the same blank page when creating this page
<apex:page sidebar="false">
    <apex:iframe src="http://www.salesforce.com" scrolling="true" id="theIframe"/>
</apex:page>

I am using Chrome 35 and I had to "load unsafe script" in order for it to render in the frame.
bob_buzzardbob_buzzard
That might be because its an HTTP URL embedded inside an HTTPS page.
Oliver UeberholzOliver Ueberholz
The non-HTTPS Page source is blocked. Try a Firefox and click on the shield symbol in the address bar. there you can temporarily deactivate this (actually good) security feature.

thanks bob, you helped me solve a similar issue for myself. Great!
karthik Umapathy 2karthik Umapathy 2
I was having similar issue, I resolved it after adding an extension called 'iFrame Allow' in Chrome browser. If anyone comes across the same issue, please try this! it works :)

Thanks!
kotakonda harikotakonda hari
hi , i am also facing Blank page on this url  <apex:iframe src="http://bizapp1qa.intra.aricent.com/ibssso/pbv3frqa/ui/#/home" frameborder="0" /> even adding an extension called 'iFrame Allow' in Chrome browser.pls help to me
 
karthik Umapathy 2karthik Umapathy 2
@Hari, 

After adding the extension, browser needs to be restarted. Have you done this ?
kotakonda harikotakonda hari
hi karthik,

its working for google or salesforce.com url but my main url not working is there any issue.
 
kotakonda harikotakonda hari
hi karthik,

whenver i given this url  http://bizapp1qa.intra.aricent.com/ibssso/pbv3frqa/ui/#/home to new tab ts working. but, only inside salesforce page is  not working.