Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Dont't want to load useless JS files

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1058 Views
  • suntrop
    Avatar
    Community Member
    131 Posts

    Dont't want to load useless JS files Link to this post

    SS loads a bunch of JS files at the end of my pages (Prototype, behaviour.js, i18n.js ...).

    But I really don't need them on my page. It just cranks up download time for users. Where do I fix that?

  • patte
    Avatar
    Community Member
    63 Posts

    Re: Dont't want to load useless JS files Link to this post

    In Page_Controller I use this for excluding prototype and thirdparty scripts, like userforms

       public function init() {
          parent::init();
          Requirements::block('sapphire/thirdparty/jquery/jquery.js');
          Requirements::block('userforms/thirdparty/jquery-validate/jquery.validate.min.js');
          Validator::set_javascript_validation_handler('none');
       }

  • suntrop
    Avatar
    Community Member
    131 Posts

    Re: Dont't want to load useless JS files Link to this post

    patte, thanks for your help. You saved my users a lot of traffic

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: Dont't want to load useless JS files Link to this post

    The search field wants to load lost of validation js. You can kill those in your _config file with the following line:

    Validator::set_javascript_validation_handler('none');

    1058 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.