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
RhooseboyRhooseboy 

Pagereference redirect from IFRAME only working in developer mode

Hi - I'm trying to use a home page component to direct users to an agreement that they need to sign before they can use our SF system.

 

The home page component uses and IFRAME that calls a VF page. The apex class then does some processing, and if they haven't already agreed to the rules, then the page redirects to the agreement page, with the following code:

 

 if (agrees != true) {
    PageReference pageRef = new PageReference('/apex/useragreement');
    pageRef.setredirect(true);
      return pageRef;

The idea is that the IFRAME on the homepage is very small so hidden, and if this condition is true, the agreement page needs to open over the home page, preventing the user from doing anything until they agree.

 

This works fine with developer mode ON for a user, but the redirect only stays within the IFRAME if developer mode is OFF.

 

Any idea how I can get the redirected page to open on the top for ALL users?

 

Thanks.

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I wrote a blog post a while ago regarding refreshing the parent page from an embedded VF page - the mechanics of this should work in this case too, as long as the iframe is an immediate child of the parent page.

 

http://bobbuzzard.blogspot.com/2011/05/refreshing-record-detail-from-embedded.html

All Answers

bob_buzzardbob_buzzard

I wrote a blog post a while ago regarding refreshing the parent page from an embedded VF page - the mechanics of this should work in this case too, as long as the iframe is an immediate child of the parent page.

 

http://bobbuzzard.blogspot.com/2011/05/refreshing-record-detail-from-embedded.html

This was selected as the best answer
RhooseboyRhooseboy

Many thanks Bob - worked fine.