ciembor
ciembor

Reputation: 7335

What is the right extension for files with JSONP?

I have a file with JSONP (hard-written callback) and I named it file.jsonp. Unfortunately server treats it as "text/plain" and browser returns warning:

Resource interpreted as Script but transferred with MIME type text/plain.

Calling it file.json causes the same warning. So what is the right extension? It works with file.js, but I don't think it is the right way.

Upvotes: 4

Views: 1180

Answers (1)

Joyce Babu
Joyce Babu

Reputation: 20704

JSONP is nothing but pure javascript code. So the right extension for it is .js. And the correct mime type is application/javascript.

Upvotes: 4

Related Questions