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
jucuzoglujucuzoglu 

How do I reload the source of an embedded iFrame in Visualforce

For example. Say I have the following iFrame tag on my page.

 

<apex:iframe src="http://www.salesforce.com" scrolling="true" height="600" width="100%" id="docframe"/>  

 

How would I change the value of the source to another page?

 

I tried using code similar to whats presented in the iFrame Target example on here: http://www.w3schools.com/html/html_iframe.asp but on my browser (Firefox) it opens a new tab. Even when I copy and paste the example from the preceding link into my visualForce page it insists on opening a new tab in my browser.

 

How should I be doing this? (having a link open the iFrame as a target is an exceptable solution for me)

Taiki YoshikawaTaiki Yoshikawa

Hi,

 

Is it wrong?

 

<apex:page >
    <apex:form target="_top">
        <apex:iframe src="http://www.salesforce.com" scrolling="true" height="600" width="100%" id="docframe"/>
    </apex:form>
</apex:page>

 

jucuzoglujucuzoglu

I want the link to change the source of the iFrame. So the parent that the iFrame is embedded into will change the iFrame. The code I mentioned is supposed to do the trick, but something about the way the VisualForce works seems to be throwing it off.

 

I'm wondering if there is a better way (i.e. Accessing the source via the DOM) might be the way to go, but I will need someone to either provide or point me to a particular example so I can get the syntax right.