Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force the content type to text/javascript for JSONP requests #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dparnell
Copy link
Contributor

@dparnell dparnell commented Jul 5, 2014

Again after trying to use the JSON interface I have found that modern browsers won't allow JSONP responses without the correct content type

@@ -1,6 +1,7 @@
class ScriptsController < ApplicationController
respond_to :html, :json, :xml
before_filter :load_script, only: [:view, :destroy]
skip_before_action :verify_authenticity_token, if: :json_request?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it Rails refuses to send the data back with the text/javascript content type which is required by JSONP to work

@dparnell
Copy link
Contributor Author

dparnell commented Jul 7, 2014

Without it Rails refuses to send the data back with the text/javascript content type which is required by JSONP to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants