I have an application that returns PHP JSON content to an HTML page, however I do this without setting header
, such as header('Content-Type: application/json');
, ie in the application it does not have this declaration.
It works normally, the browser can normally handle JSON with JavaScript.
But one day I decided to set header
and when I called the content directly through the URL I realized that the content on the page, the font of the text, gets smaller when I set the header
by passing in Content-Type
the value application/json
comparing if it had not defined the same or with Content-Type
presenting a different value, as if it were to return an HTML for example header('Content-Type: text/html; charset=utf-8');
.
From this I would like to know. What's the difference in setting header
or not in a PHP application? Is there any performance increase setting header
since the text changed to a font and a different style when the content was JSON? Why this difference from how content is displayed on the screen?