Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants