I'm working on an API that sends HTML forms to external AJAX apps.
Would it be abusing the HTTP headers if I include information such as stylesheets and scripts to use in the headers? I'd like to keep the HTML as clean as possible.
I'm working on an API that sends HTML forms to external AJAX apps.
Would it be abusing the HTTP headers if I include information such as stylesheets and scripts to use in the headers? I'd like to keep the HTML as clean as possible.
This feels like a bad idea.
Although you want to keep the HTML as clean as possible, the HTML block is the 'proper' place to put information on what stylesheets and scripts to include - as they have specific meanings to the HTML.
Putting it in the HTTP headers, although possible using custom header fields ("X-something-or-other"), obfuscates the way in which your app works making things more difficult for future developers to understand, and can inadvertently break should you need to change things later (such as your web server, HTTP client)...
In my point of view: Yes it would.
You better have to keep your transmission protocol (HTTP which is precisely specified in some RFC) as clean as possible than the message transmitted (HTML).
If you are working on creating an API, maybe you should create specifics XML messages that would contain 3 encapsulating parts: one for your stylesheets, one for your scripts and one for your HTML.
That's just an idea, I don't know what your are doing exactly.