Skip to content
Rails: Normal cookies inside IFrames for IE via P3P headers
Find file
Latest commit f1852ec Dec 30, 2014 @grosser just use a middleware
Failed to load latest commit information.
gemfiles update all Dec 26, 2014
lib v0.2.0 Dec 26, 2014
test preload all so we do not get random test errors Dec 26, 2014
.travis.yml travis Dec 26, 2014
Gemfile abandon appraisal Nov 28, 2013
Gemfile.lock update all Dec 27, 2014
MIT-LICENSE certs Nov 28, 2013
Rakefile rails 4.1 and 4.2 Dec 26, 2014 just use a middleware Dec 30, 2014
ie_iframe_cookies.gemspec rails 4.1 and 4.2 Dec 26, 2014

Rails: Enabled cookies inside IFrames for IE via P3P headers.

Deprecated / Unmaintained

use something like this instead:

class AllowCookiesInIframesMiddleware
  def initialize(app)
    @app = app

  def call(env)
    response, headers, body =
    headers['P3P'] = %{CP="NOI DSP COR NID ADMa OPTa OUR NOR"}
    [response, headers, body]

Old Readme

IFrames in IE only get the same cookies as normal pages when P3P headers are added
=> 'iframe-using' IE users get P3P headers on every request
304 Not modified pages do not get P3P headers (via ETag)
=> 'iframe-using' IE users do not get 304


gem install ie_iframe_cookies


To cookie-tag users as 'iframe-using', add this to all actions rendered inside IFrames.
(only IE users are tagged)

before_action :normal_cookies_for_ie_in_iframes! # only: [:foo, :bar]


  • Problems with Safari? try this or that



Sascha Depold

Michael Grosser
License: MIT
Build Status

Something went wrong with that request. Please try again.