Posts

Showing posts from April, 2010

Retaining license details in javascript files while minifying using YUICompressor

Minification is one of the methods suggested by yahoo's yslow plugin . During minification process all comments in a javascript file are removed, long variables names are replaced with shorter ones, removing unwanted spaces, removing empty lines, making the minified file size as minimum as possible. If we are using a third party javascript file whose license should be intact while sending to the outside world. Using YUICompressor 's default setting it removes all the comments while include license info as well. If you want a comment block not to be removed by compressor while minifying, then that comment block should start with ! For example if the input is /*! this is my js should include license */ var myFunc = function() { /* this comment i dont want in minified version*/ ... } Then the output of compression will be like /*this is my js should include license */ var myFunc= function() {...} thus retaining the comment after minification as well.

Browser behaviour when 403 Response with Content-Disposition Attachment header

If client requests for a file download for which the logged in user does not have permissions, server should not set content-disposition:attachment header. If the header is set and if 403 (Forbidden) status code returned by the server, then client shows weird message as file not found.