How to remove standard platform JavaScript from a Visualforce page when it is not needed?

I had the exact same experience. To my knowledge, it can't be done. I created an idea for it...maybe you could vote for it? Maybe all of you could vote for it. :)

https://success.salesforce.com/ideaView?id=08730000000l2Y8AAI


I've done some digging... The inclusion of AjaxScript is a bug - it should only be included if the VF page contains an <apex:form>. It's fixed in Summer '14 (safe harbor).

stub.js... On the upside, it's only 1289 bytes, but on the downside it's a blocker for putting a mobile web app on VF and having it behave nicely. I'm working on raising the priority of a fix.


One way to do this is to write your own template providing function in Angular. The idea here is to do something like this:

  1. generate a service that using the standard $http.get functionality grab the template you want to load.
  2. Utilize a clever regex to strip out VF specific javascript tags from the retrieved html
  3. Hand that html off as the template.

I've got this functioning in an existing org. Let me talk to the owner of the org about open sourcing this bit. We've found a significant decrease in load times for VF templates this way.