is it possible to minify all outputed client side code automatically?
i want to be able to minify (remove all white space) to any page provided to the end-user. the thing that bothers me is that all ajax calls is visible to the end-user and was wondering if i minified it if that would minimize the security treat and if i removed that and class 开发者_StackOverflow社区files out of the www and put them elsewhere if the end user would still be able to access it or do damage or help with security
thanks
While obfuscatiing your output won't provide much in the way of security, you can achieve what you want by wrapping your code in Output Buffering and running it through your own obfuscation filter before returning it to the client.
As you are being told already it won't provide any security improvements. You would only make it harder to get a hold on your ajax/javascript calls on your webpage. Using output buffering is one option, if you are using a template parser you can also add your own code right before the template is parsed/outputted so remove whitespace. However, make sure you don't delete any of the spaces between text ;-)
I guess it will be a hell of a function to create and in the end I think it makes too little sense to create this to be worth the time creating it.
精彩评论