Skip to content

Instantly share code, notes, and snippets.

@mshanemc
Created April 24, 2015 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshanemc/5c7dd7703037d91e9e6e to your computer and use it in GitHub Desktop.
Save mshanemc/5c7dd7703037d91e9e6e to your computer and use it in GitHub Desktop.
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