• #15310
    Salesforce | Mohit Mohit #401
    Forcetalks

    How can we give auto size the Salesforce visualforce page?

    Hi All,

    How can we give auto size the visualforce page?

    I have a scenario in which my content on the VF page is dynamic, so I can’t have a fixed height of the frame. What is the proper way to implement auto resize the iframe for VF.

    Please give suggestions.

     

    #15653
    Salesforce | PRANAV PRANAV #679
    Forcetalks

    Hi Mohit,

    Use this code for auto sizing Visualforce Page:

    <apex:page sidebar=”false”>
    <apex:iframe src=”https://www.salesforce.com/” id=”theFrame” />
    <script>document.getElementById(‘theFrame’).height = window.innerHeight – 220;</script>
    </apex:page>

    Hope this helps you.

    #41235
    Forcetalks

    Hello,

    You can do something like this:

    HTML
    <div id=”boxContainerContainer”>
    <div id=”boxContainer”>
    <div id=”box1″></div>
    <div id=”box2″></div>
    <div id=”box3″></div>
    </div>
    </div>
    CSS
    #boxContainerContainer {
    background: #fdd;
    text-align: center;
    }

    #boxContainer {
    display:inline-block;
    border:thick dotted #060;
    margin: 0px auto 10px auto;
    text-align: left;
    }

    #box1,
    #box2,
    #box3 {
    width: 50px;
    height: 50px;
    background: #999;
    display: inline-block;
    }

    Thanks.

    #54741
     William #5
    Forcetalks

    Try this code:

    <apex:page sidebar=”false”>

    <apex:iframe src=”https://www.salesforce.com/” id=”theFrame” />

    <script>

    (function() { //this wrapper prevents pollution of the global scope

    var windowOnresize = window.onresize;

    window.onresize = function() {

    if (windowOnresize) windowOnresize(); //don’t trample the handler; intercept it

    document.getElementById(‘theFrame’).height = window.innerHeight – 220;

    };

    }());

    </script>

    </apex:page>

Viewing 4 posts - 1 through 4 (of 4 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?