One visualforce page as an iframe in another visualforce page – Salesforce.com

There may be requirement some times to open one visualforce page into existing page as an iframe.

To achieve this, we can use below lines of code in Visualforce.

<ifram src=”…/MyVFPage?var1= { ! MyVariable1 } &&var2= {  ! MyVariable2 } ” …/>

where { ! MyVariable1 } is custom variable.

to read above parameters in resultant visual force page, we can use:

PageReference pageRef = ApexPages.currentPage();
Map pageMap = pageRef.getParameters();
String var1 = pageMap.get(‘var1‘)

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.