added jsonp /api/getcomments so you can retrieve them cross-domain #105

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

danshearmur commented Nov 4, 2011

I have added a JSONP callback so that you can grab the comments with javascript on a different domain.

I am working on a javascript widget to display comments from a news story on your own web page/

Contributor

danshearmur commented Nov 4, 2011

https://github.com/danshearmur/lamercomments is the widget I was talking about.

Contributor

danshearmur commented Nov 5, 2011

In my preliminary experiments adding type="application/javascirpt" to the <script> tag requesting the JSONP worked in latest Chrome, Safari and Opera.

From what I can see this is not a good idea:

  • In jQuery you cannot change the accepts header on a jQuery request
  • I haven't tested in older browsers (Or IE)
  • 'text/javascript' is still the default type for <script> tags, even if we don't need to include it in markup anymore
Contributor

nrk commented Nov 5, 2011

@danshearmur thanks for checking this up quickly, mine was just a question precisely because the RFC (which dates back to 2006) states one thing but browsers are often late to adapt for various reasons, so if text/javascript is still the default for requests generating from the <script> tag then I guess it's perfectly fine like that.

Contributor

danshearmur commented Nov 5, 2011

Glad to help out!

danshearmur closed this Apr 3, 2014

danshearmur deleted the unknown repository branch Apr 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment