Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

use local copy of jquery-min #215

Open
richsalz opened this issue Jan 25, 2021 · 4 comments
Open

use local copy of jquery-min #215

richsalz opened this issue Jan 25, 2021 · 4 comments

Comments

@richsalz
Copy link
Contributor

inc/head.shtml, which is included by just about every file on the site, has these lines

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./inc/libs/jquery-3.5.1.min.js"%3E%3C/script%3E'))</script>

You should replace them with this single line:

<script src="/inc/libs/jquery-3.5.1.min.js"></script>

This will use the cached script and not go to a central site to download a file that is, well, already on your site. :)

ping @levitte

@levitte
Copy link
Member

levitte commented Jan 25, 2021

There are quite different views on this. For example, one might consider browser caches, and https://jquery.com/download/#using-jquery-with-a-cdn :

... This also offers an advantage that if the visitor to your webpage has already downloaded a copy of jQuery from the same CDN, it won't have to be re-downloaded.

@richsalz
Copy link
Contributor Author

Most of that page is not relevant because you're using the minimized version, you're pinning to a particular version, and you are already using a CDN.

You do know who I work for, right? :)

@levitte
Copy link
Member

levitte commented Jan 25, 2021

I know who you work for. However, if a browser sees a reference to code.jquery.com and another to www.openssl.org, it will load it twice, even if pinned on the same version. Nothing of what you said contradicts that.

@richsalz
Copy link
Contributor Author

I know who you work for. However, if a browser sees a reference to code.jquery.com and another to www.openssl.org, it will load it twice, even if pinned on the same version. Nothing of what you said contradicts that.

Even if the link is the same, the browsers now separate the cache by origin so it will be loaded twice.

Shrug. A minor optimization. Feel fee to close if you disagree (but you're wrong :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants