Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
responsive visualforce Iframes
<apex:page showHeader="false" sidebar="false" standardStylesheets="false" docType="html-5.0">
<script type="text/javascript">
//redirect to desktop-only version of page
if( (typeof sforce == 'undefined') || (sforce == null) ) {
if ({!isnull($CurrentPage.parameters.iframeurl)}){
window.location.assign("{!$Page.responsiveIframeDesktop}");
} else {
window.location.assign("{!$Page.responsiveIframeDesktop}?iframeurl={!$CurrentPage.parameters.iframeurl}");
}
}
</script>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<apex:iframe src="{!if(isnull($CurrentPage.parameters.iframeurl), 'https://www.salesforce.com', $CurrentPage.parameters.iframeurl)}" id="iframe" width="100%" height="4000px"/>
</apex:page>
<apex:page showHeader="true" sidebar="false" standardStylesheets="true" docType="html-5.0">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<apex:iframe src="{!if(isnull($CurrentPage.parameters.iframeurl), 'https://www.salesforce.com', $CurrentPage.parameters.iframeurl)}" id="iframe" width="100%" height="4000px"/>
</apex:page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.