function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Walter@AdicioWalter@Adicio 

can i use jQuery to change height , page layout iframe from link in VF page same iframe?

I would like a user to be able to click a link to increase the size of the page layout section (iframe). Is this possible?

 

Im having trouble but this is what I am trying. I see I am able to return the size of the document and window, and the returned size is correct but I am not sure how to set the height or if I can.

 

in my scenario the iframe is 500px in sf page layout editor and jQuery returns the document size as 3900px.

 

I notice sf is not using css for the iframe instead their using the actual height attribute in the iframe. is the problem that jQuery is trying to change the css height value and it cannot find any css height value to begin with?

 

	   	jQuery("#more").click(function() {
	   		
	   		var i = jQuery(document).height();
	   		
	   		jQuery(window).height(i);
	   		
	   	});

 

 

ive tried targeting the actual ID of the iframe i want to change instead of "window" but its doing the same thing , which is nothing.

 

thank you for any advice.

Walter@AdicioWalter@Adicio

found this on another board which is working. just sharing if anyone is currious.

 

 

jQuery(document).ready(function() {  

		var theFrame = jQuery("#my_iframe_id", parent.document.body);
		theFrame.height(jQuery(document.body).height() + 30);

 }); 

 

bob_buzzardbob_buzzard

Is your VisualForce page embedded in a standard detail page?  If so, you can't do this.  The Iframe that contains the VF page comes from a different server to the standard page.  When you attempt to access/modify information from the main page, the browser considers this cross site scripting and blocks it.

Venkat PolisettiVenkat Polisetti

 


bob_buzzard wrote:

Is your VisualForce page embedded in a standard detail page?  If so, you can't do this.  The Iframe that contains the VF page comes from a different server to the standard page.  When you attempt to access/modify information from the main page, the browser considers this cross site scripting and blocks it.


 

I have used the below code in several of my embeded VF pages on my Unlimited edition and it is working and does resize. But on an Enterprise Edition, it is throwing an exception because of a cross domain issue. I have no clue why they render these pages one way in UE and the other way in EE. Both orgs have s-controls in use, if it matters any thing.

 

        var sframe=top.document.getElementById(window.name);
        
        var m = top.document.getElementById(mapId);
        
        alert('map text = ' + m.style.height);
        
        if (navigator.userAgent.indexOf("Firefox") != -1) //if Firefox
            var nHeight = document.body.scrollHeight+10; //add ten pixels to height of sControl frame
        else  //IE and others
            var nHeight = document.body.scrollHeight; //use the returned height of sControl frame
            
        sframe.style.height = nHeight+"px";

 

I am literally clueless and banging my head against the wall.

 

Venkat

RJ PalomboRJ Palombo

Venkat,

 

Get with me when you can on this. I'm trying to get a JQuery solution myself.

 

-RJ