antirez / lamernews

Lamer News -- an HN style social news site written in Ruby/Sinatra/Redis/JQuery
http://lamernews.com
Other
1.35k stars 200 forks source link

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

Closed danshearmur closed 10 years ago

danshearmur commented 13 years ago

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/

danshearmur commented 13 years ago

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

danshearmur commented 13 years ago

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:

nrk commented 13 years ago

@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.

danshearmur commented 13 years ago

Glad to help out!