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

Example to include one visualforce page into another visual force with the help of iframe and getting back the request parameter in visual force page.

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‘)

Related posts

Leave a Reply

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