You need to sign in to do that
Don't have an account?
Dynamically Resize iFrame.
I know all about the security restrictions implemented in browsers regarding cross domain scripting from within an iFrame, but that doesn’t mean this is not possible. Yes, I have found a method but it would require some help from SalesForce.com.
If you are lost right now, the idea is simply to have the capability to dynamically resize a salesforce.com iFrame that contains items such as your S-Controls or web page via a URL Tab. You may have noticed that when the data you are trying to display exceeds the boundaries of the iFrame you then see scroll bars that enable the user to slide the view around so they can see everything.
There is a way through client side scripting to resize the iFrame, but you will get an “Access Denied” message if you attempt to accomplish this resizing via scripting from within your own custom page that is hosted on another domain.
So… After all of that, my first question to pose to this community is:
Is there a current method that salesforce.com allows us as developers to use in order to resize the iFrame?
Second, is anyone else interested in this functionality?
Thirdly, and only if there is no current method for this, would the good people at salesforce.com be willing to hear a possible solution to safely solve this issue and allow us this type of functionality?
Basic Solution: I bumped into this method in my search to solve this issue, so I can’t take credit for it, but I have tested it and it works. The cost to SalesForce is an inclusion of a small html page with a small bit of JavaScript that in itself alters the iFrame for you. It starts out with the Salesforce.com iFrame that houses your information. Then from your web page, you can get the name of the iframe that houses your page in SalesForce. You then place a small, possibly hidden, iFrame on your web page that links back to the small script page on salesforce.com domain and passes it, via the URL parameters, the main iFrame name/id and the size of your content. That small script located at salesforce.com, which is in their control, then resizes the main iFrame for you. This allows you to sidestep the cross domain security issue because the script that modifies the iFrame is also hosted within the same domain. -- Clear as mud, huh?
Does any of this make sense? Hope it was worth my time to post it.
On a domain I own, I am embedding the Salesforce Knowledge Base, which is run on the salesforce.com domain. Ugh.
There's also another problem... no way to report Solution usage within a certain date range. Or how many Solutions were viewed by a given user. I cannot even add a page tag (such as Google Analytics) to get my own reporting.
The only time I have ran into this issue is with the public knowledge base feature -- I was researching that issue and came across this post.