No commit activity in last 3 years
No release in over 3 years
Rack middleware for iframe-transport hacks.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

rack-iframe-transport

Rack middleware for iframe-transport hacks.

Get Rails to work nicely with jquery-iframe-transport. Post data to an iframe and retrive data from there is still the only reliable way to post file in a javascript application.

This middleware get Rails to work nicely with jquery-iframe-transport or other code of yours that exploit this hack.

What it does?

It wrap the response in a html. The original response is insert inside a <textarea> tag.

Since you can't get headers from an iframe post, metadata are exposed as 'data-*' attributes of the textarea tag.

> curl localhost:3000/api/2/account
  {"message":"Unauthorized"}

> curl 'localhost:3000/api/2/account?X-Requested-With=IFrame'
  <!DOCTYPE html><html><body><textarea data-status='401' data-statusText='Unauthorized' data-type='text/html'>{"message":"Unauthorized"}</textarea></body></html>

How?

Something like this, its just a Rack middleware.

# config/initializer/iframe_transport.rb
require 'rack_iframe_transport'
Teambox::Application.config.middleware.use Rack::IframeTransport

Pull request?

Yes.