WordPress.org

Ready to get started?Download WordPress

Forums

Is it necessary to always include prototype.js? (7 posts)

  1. lborgman
    Member
    Posted 6 years ago #

    I just noticed that prototype.js is included in every page. It is 70k and takes some time to download (for new visitors). Is it really necessary to include this on every page? Is it used?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Prototype is not included on every page unless you have a theme or plugin that is including it or something else that depends on it. It is included on all the admin pages, mind you, because almost all of them use it in some fashion.

    Post a link to your site, so we can see what's going on for ourselves.

  3. lborgman
    Member
    Posted 6 years ago #

    Thanks Otto42, I thought it was something in my theme. I built that theme without looking very carefully at the bottom plates for it. However I switched to WordPress Default 1.6 to see if that theme also loaded it. To my surprise it did.

    Could it be some plugin I am using that needs it? I am currently using

    - Akismet
    - Automoderate comments
    - Comments Post Rewriter
    - Simple Tags
    - Text Control
    - WordPress Hashcash
    - wp-cache

    I also have

    - Bad Behaviour
    - Challenge
    - Hello Dolly
    - Simple CPR Log Reader

    installed, but they are not activated.

    It looks to me however as a bug, since there are no JavaScript at all used on my pages (except when commenting or doing administration).

    My site is here (in Swedish): http://OurComments.org/blog/

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    The Comments Post Rewriter plugin uses extensive amounts of javascript, and it appears to be using prototype in some places. The most notable place is on single post pages, it's directly using Event and the ${} trick, both of which are parts of prototype.js.

    Looking through your pages, you have lots and lots of javascript. You probably don't know about it, because it's all added by plugins (near as I can see).

  5. lborgman
    Member
    Posted 6 years ago #

    Otto42: Ah, thanks, I did not notice. I never tried to see how it was implemented. I expected something using just "onsubmit".

    Maybe some day I should take some time to learn to read this kind of Javascript. It is quite impressive. How does it come that you so easily recognized Event?

    But what is the ${} trick?

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Maybe some day I should take some time to learn to read this kind of Javascript. It is quite impressive. How does it come that you so easily recognized Event?

    I did a lot of reading on the Prototype JS framework a while back. http://prototypejs.org

    But what is the ${} trick?

    One of prototypes very handy utility bits. $('someid') returns the contents of the element on the page with an id of 'someid'.

  7. lborgman
    Member
    Posted 6 years ago #

    Thanks Otto42.

Topic Closed

This topic has been closed to new replies.

About this Topic