Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading Script globally on a website

I have a website that features some sort of plugin that requires a 30-line script. Such plugin is present throughout the site pages (well, by now there are just two), because it is part of the header, which is also identical.

I'd like to know if there's a way to avoid executing that 30-line-long script every time I change from a page to the next, since the header is identical, thus improving loading time. (If you say 30 lines of code is nothing for a browser, then my question will be answered)

like image 789
Nico Avatar asked Jan 18 '26 11:01

Nico


1 Answers

Don't worry, the script will be cached by the browser and won't be downloaded again. About 30 lines of code being a lot or not: depends on what those lines do! It's possible to write extremely expensive code with only a few lines, or even a one-liner.

like image 144
bfavaretto Avatar answered Jan 21 '26 01:01

bfavaretto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!