What if browsers shared resources across same origin tabs using a share
attribute on <link>
and <script>
tags which will take a regex pattern so that if other tabs with the same origin and paths’s match the regex
pattern of the share
attribute they don’t have to request that resource again.
It’ll work like the following:
<link rel="stylesheet" src="https://example.com/style.css" share="/*">
Now when I open another tab with the same origin let’s say the link being: https://example.com/it/could/be/whatever
, mind you I already have https://example.com
open
and that tab is requesting that same css
file above the browser has already loaded it, and therefore doesn’t have to request it again.
the share
pattern allows https://example.com/it/could/be/whatever
to use that css file because it’s /*
allowing any path that needs to request it, but this only works for same origin tabs.
Also the new fetch
api could allow:
fetch('style.css', {share: true});
Isn’t that what caching is for??
No the share attribute is only storing it in the browser until each tab of that origin is closed and then it’s gone.
The easiest use would be, sites that stay the same could easily add the share
attribute, and not have to setup a cache or use ServiceWorkers
.
Therefore I could easily just add a share="/*"
to my links and scripts.
This will allow me to open multiple tabs of the same origin and have them load much quicker.
Now if I were to update my resource, the new one would load when the first tab with that origin opens again.
I feel like I repeated myself a couple times. So I’ll stop here, what do you guys think??
But one more thing, it could just be a Boolean
now whenever the browser request that same file it just uses it. But the regex
path would prevent some paths from accessing it, not sure if that’s necessary?? but that was my initial thought.