1. A method, comprising: sending a request to a server, wherein the request is sent by a software application executing on a computer, wherein the software application includes a set of functions for obtaining and presenting information, and wherein the set of functions can be invoked by scripts that are retrieved and executed by the software application; in response to the request, receiving a first script and at least a second script from the server, wherein the first script includes instructions for intercepting invocations to the set of functions, and wherein the second script includes at least one invocation to at least one function in the set of functions; executing the first script, thereby causing subsequent invocations to each function in the set of functions to be intercepted by a corresponding resource optimization handler; executing the second script; and when the executing second script invokes a function in the set of functions, intercepting said invocation of the function, and invoking a resource optimization handler corresponding to the function instead of invoking the function.