Answers.Body: <p>After a lot of desperate digging we have come up with a work-around. I think the right answer is: Don't use iframes. There seems to be thoughtful reasons to restrict the flow of cookies/session information between an iframe and the parent and even though we have figured out a way to work-around it now, I'm not confident these tricks will work in the future.</p>
  
  <p>Having said that...</p>
  
  <p>For Internet Explorer, we got it to work by sending a header declaring our <a href="http://www.w3.org/TR/P3P/" rel="nofollow">P3P policy</a>. We used the following in settings.php (I'm sure you could put it in civicrm.settings.php too):</p>
  
  <pre><code>header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
  </code></pre>
  
  <p>That seemed to placate IE (note: you should really lookup what these codes mean before blindly putting this into place - each one of these codes has meaning - more information on meaning is <a href="http://www.w3.org/TR/P3P11/#compact_policies" rel="nofollow">available here</a>).</p>
  
  <p>Safari was much harder. We had to add the javascript provided on <a href="http://measurablewins.gregjxn.com/2014/02/safari-setting-third-party-iframe.html" rel="nofollow">a helpful blog post</a> to get things working. It's a crappy solution - since it essentially redirects the user to the CiviCRM page and then back to the iframed page - which is confusing for the user and delays the loading of the page.</p>
  
  <p>Here's the code I added to the Drupal theme's template.php file:</p>
  
  <pre><code>function tceiframe_preprocess_html(&amp;$variables) {
    // Call our parent to do most of the work.
    newsflash_preprocess_html($variables);
    $path = drupal_get_path('theme', 'tceiframe');
    drupal_add_js($path . '/safari.iframe.fix.js');
  }
  </code></pre>
  
  <p>And here is the javascript:</p>
  
  <pre><code>window.onload=function(){
   if(navigator.userAgent.indexOf('Safari')!=-1&amp;&amp;navigator.userAgent.indexOf('Chrome')==-1){
    var cookies=document.cookie;
  
    if(top.location!=document.location){
     if(!cookies){
      href=document.location.href;
      href=(href.indexOf('?')==-1)?href+'?':href+'&amp;';
      top.location.href =href+'reref='+encodeURIComponent(document.referrer);
     }
    } else {
  
     ts=new Date().getTime();document.cookie='ts='+ts;
     rerefidx=document.location.href.indexOf('reref=');
     if(rerefidx!=-1){
      href=decodeURIComponent(document.location.href.substr(rerefidx+6));
      window.location.replace(href);
     }
    }
   }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-02T19:11:36.590Z
Answers.Text: Jamie, is there a public repo where one could look at your code? I have just received a request to provide CiviCRM for membership and event management to an organization that uses a proprietary CMS. I might propose the old standby of mimicking the branding of the site and its header on a Drupal or WordPress install of CiviCRM, but that causes the maintenance headache of keeping that stuff in sync over the months and years.
Answers.UserDisplayName: Joe Murray
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-04T14:55:18.530Z
Answers.Text: Hi Joe - for IE - I really did just insert exactly what I put in my answer into the settings.php file.
Answers.UserDisplayName: Jamie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-04T14:56:31.127Z
Answers.Text: The safari code is in the private repo of the organization that is using it. But I can share the snippet here. I put this in the function.php file of the custom theme that we specifically designed to be served as an iframe (all styling is removed - just a white back ground and no borders):
Answers.UserDisplayName: Jamie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-04T14:57:38.063Z
Answers.Text: stack exchange doesn't seem to want me to add this stuff as a comment so I will edit my answer instead.
Answers.UserDisplayName: Jamie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-12T18:18:19.120Z
Answers.LastActivityDate: 2016-03-04T15:00:28.877Z
Answers.LastEditDate: 2016-03-04T15:00:28.877Z
Answers.UserDisplayName: Jamie
Body: <p>We've been using iframes on remote sites to embed CiviCRM contributions pages with generally good results. However, we've recently found out that it is failing in Internet Explorer and Safari. It seems that it has to do with browser policies on allowing cookies set via iframes. Anyone else experienced this? Any ideas on how to resolve it?</p>
  
  <p>It's a bit of a struggle since neither browser will install on linux, however, one user reported getting:</p>
  
  <pre><code>We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.
  </code></pre>
  
Tags: <cookies>
Title: Using iframes to present contribution page on remote site
ThreadText: # Using iframes to present contribution page on remote site
  
  (Asked by: username_0 on 2015-08-12)
  
  We've been using iframes on remote sites to embed CiviCRM contributions pages with generally good results. However, we've recently found out that it is failing in Internet Explorer and Safari. It seems that it has to do with browser policies on allowing cookies set via iframes. Anyone else experienced this? Any ideas on how to resolve it?
  
  It's a bit of a struggle since neither browser will install on linux, however, one user reported getting:
  
  ```
  We can't load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.
  
  ```
  
  **Tags:** cookies
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-08-12. Score: 4
  
  After a lot of desperate digging we have come up with a work-around. I think the right answer is: Don't use iframes. There seems to be thoughtful reasons to restrict the flow of cookies/session information between an iframe and the parent and even though we have figured out a way to work-around it now, I'm not confident these tricks will work in the future.
  
  Having said that...
  
  For Internet Explorer, we got it to work by sending a header declaring our [P3P policy](http://www.w3.org/TR/P3P/). We used the following in settings.php (I'm sure you could put it in civicrm.settings.php too):
  
  ```
  header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
  
  ```
  
  That seemed to placate IE (note: you should really lookup what these codes mean before blindly putting this into place - each one of these codes has meaning - more information on meaning is [available here](http://www.w3.org/TR/P3P11/#compact_policies)).
  
  Safari was much harder. We had to add the javascript provided on [a helpful blog post](http://measurablewins.gregjxn.com/2014/02/safari-setting-third-party-iframe.html) to get things working. It's a crappy solution - since it essentially redirects the user to the CiviCRM page and then back to the iframed page - which is confusing for the user and delays the loading of the page.
  
  Here's the code I added to the Drupal theme's template.php file:
  
  ```
  function tceiframe_preprocess_html(&$variables) {
    // Call our parent to do most of the work.
    newsflash_preprocess_html($variables);
    $path = drupal_get_path('theme', 'tceiframe');
    drupal_add_js($path . '/safari.iframe.fix.js');
  }
  
  ```
  
  And here is the javascript:
  
  ```
  window.onload=function(){
   if(navigator.userAgent.indexOf('Safari')!=-1&&navigator.userAgent.indexOf('Chrome')==-1){
    var cookies=document.cookie;
  
    if(top.location!=document.location){
     if(!cookies){
      href=document.location.href;
      href=(href.indexOf('?')==-1)?href+'?':href+'&';
      top.location.href =href+'reref='+encodeURIComponent(document.referrer);
     }
    } else {
  
     ts=new Date().getTime();document.cookie='ts='+ts;
     rerefidx=document.location.href.indexOf('reref=');
     if(rerefidx!=-1){
      href=decodeURIComponent(document.location.href.substr(rerefidx+6));
      window.location.replace(href);
     }
    }
   }
  }
  
  ```
  
  > **Comments:**
  > **username_1**: username_0, is there a public repo where one could look at your code? I have just received a request to provide CiviCRM for membership and event management to an organization that uses a proprietary CMS. I might propose the old standby of mimicking the branding of the site and its header on a Drupal or WordPress install of CiviCRM, but that causes the maintenance headache of keeping that stuff in sync over the months and years.  
  > **username_0**: Hi Joe - for IE - I really did just insert exactly what I put in my answer into the settings.php file.  
  > **username_0**: The safari code is in the private repo of the organization that is using it. But I can share the snippet here. I put this in the function.php file of the custom theme that we specifically designed to be served as an iframe (all styling is removed - just a white back ground and no borders):  
  > **username_0**: stack exchange doesn't seem to want me to add this stuff as a comment so I will edit my answer instead.  
  
  ---
  
  