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
trf199trf199 

Putting a Visualforce page in the sidebar?

I'm trying to put a Visualforce page in the sidebar. I know you can do this by adding a homepage html component containing an iframe that points to your Visualforce page, but this seems to cause a "Redirect Loop" error in Firefox.

 

"Redirection limit for this URL exceeded.  Unable to load the requested page.  This may be caused by cookies that are blocked."

 

It works ok in IE though.

 

Does anyone know any other or best practice ways to include Visualforce content in the sidebar?

 

Thanks,

 

 

Tom

Best Answer chosen by Admin (Salesforce Developers) 
trf199trf199
The answer to this problem is that you have to tell Firefox to accept third party cookies, because most of the page comes from the salesforce.com domain, and the iframe containing the VF page comes from force.com. Failing to allow third party cookies messes with the redirection

All Answers

wesnoltewesnolte

Hey

 

I have used a template to create a sidebar, and then each of my pages uses this template. Have a look at the SiteTemplate.page in your Org.

 

Your steps would be something like this:

 

1. Create a tempalte ie. a Page with <apex:page sidebar="false"....>

2. In this page create an outputPanel(div) on the left that is your sidebar and a blank content area that your pages will use

3. Create <apex:insert> tags where you'd like to insert content into the template

4. Create your new page set <apex:page showHeader="false"

5. Include the template in your page <apex:composition name="templatePageName">...

6. To insert content into the tmeplate use <apex:define name="insertName">page content here</apex:define>

 

This will make your app consistent. There's alot to learn initially but this simplifies things in the long run. I recommend looking at SiteTemplate.page as well as all of the components it uses. Also use the component reference to read up on all the visualforce I've mention here i.e. apex:define, apex:composition, apex:insert

 

Cheers,

Wes

trf199trf199
Thanks for the reply. What you suggest sounds interesting. I'm just wondering - if I want to display the sidebar across all or most of the site, would that mean making a replacement Visualforce page for each of the different pre-existing pages e.g. contacts, accounts, opportunities? I want to be able to distribute this as an app with minimal impact to the user, i.e. how they have their pages setup.
wesnoltewesnolte

Unfortunately yes. Any standard pages wouldn't be able to use this template unless they were replaced with visualforce pages.

 

It's a pity the side bar isn't more easily configurable, but I'm sure it's in their road map.

 

Wes

dkorba2k5dkorba2k5
We have a sidebar homepage component that works fine both in IE and FF.  Post your page and the iframe tag you're using on the homepage component so that we can see if there's something that you can change to make it work correctly without having to go thru to each and every page.
trf199trf199

 Thanks, the html component is as follows:

 <iframe style="border: medium none ;" src="/apex/nvmagent?core.apexpages.devmode.url=1" width="100%" height="350"></iframe>


The page is as follows:

 <apex:page sidebar="false" controller="MyController" tabStyle="Account" showHeader="false">

<!-- <apex:form >-->
<!-- <apex:pageBlock title="Congratulations {!$User.FirstName}">-->
<!-- You belong to the Account Name: <apex:inputField value="{!account.name}"/>-->
<!-- <apex:commandButton action="{!save}" value="save"/>-->
<!-- </apex:pageBlock>-->
<!-- </apex:form>-->


  <apex:pageBlock title="AMB stuff">
  login: {!loginResult}<br />
  <apex:outputPanel id="statusPanel"> 
  status: {!Status}
  <apex:actionStatus startText=" ." id="myStatus">
  </apex:actionStatus>
   
  <apex:form >
   
  <apex:actionPoller action="{!checkStatus}" reRender="statusPanel,flags" interval="5" status="myStatus" oncomplete="checkFlags()"/>
  <apex:commandButton action="{!checkStatus}" value="update" reRender="statusPanel,flags" status="myStatus" oncomplete="checkFlags()" />
  <!--<apex:actionFunction name="checkStatusFunction" action="{!checkStatus}" rerender="statusPanel" status="myStatus" timeout="10000" immediate="true"/>-->
  </apex:form>
  </apex:outputPanel>
   
  <apex:outputPanel id="flags" layout="block">
  <input type="hidden" id="displayDialPanel" value="{!DisplayDialField}"/>
  </apex:outputPanel>
   
  <apex:form >
  <p id="dialPanel" style="display:none;">
  <input type="text" id="dialField" value="" size="20" style="width:100px"/>
  <apex:commandButton action="{!dialNumber}" value="dial" />
  </p>
  </apex:form>
   
  </apex:pageBlock>

  <button onclick="checkFlags()">check flags!</button>
  <script type="text/javascript">

  function checkFlags()
  {
  document.getElementById("dialPanel").style.display = document.getElementById("displayDialPanel").value;
  }
   
  </script>
</apex:page>


 

Firefox version is 3.0.11. I think I get the redirect loop error no matter how simple the visual force code, so maybe the iframe is at fault?

trf199trf199
This is interesting. I just logged into salesforce in Firefox and the iframe worked on the first page (the welcome to developer edition page, which is an Apex one). When i browse to the setup pages, then back to the start page the iframe reverts to showing the redirect loop error.
trf199trf199
It seems to be a bit intermittent
trf199trf199

I believe I've narrowed the problem to not displaying when in standard pages, only when in visualforce pages, something to do with whether salesforce is redirecting to the c.na6.visual.force.com or na6.salesforce.com domain? Can you post your html component please for comparison? Thanks

trf199trf199
The answer to this problem is that you have to tell Firefox to accept third party cookies, because most of the page comes from the salesforce.com domain, and the iframe containing the VF page comes from force.com. Failing to allow third party cookies messes with the redirection
This was selected as the best answer