3 ms·
We have a system where all of our static assets are prefixed with the SHA1 of the git commit that produces them. It's a great cache-busting technique for CDNs.
by kccqzy 8y ago
We have a system where all of our static assets are prefixed with the SHA1 of the git commit that produces them. It's a great cache-busting technique for CDNs. But this also means we cannot use paths like /img/background.jpg but rather /<insert 40 hex chars here>/img/background.jpg when we refer to such assets. Of course most of the time we can compute this by JavaScript on the client side but it's often easier just to use <base> and get rid of that piece of JavaScript.
Another use class is to change all links to open in a new tab by setting only "target" on the <base>. This happens on marketing sites with a lot of third party links so the marketing department naturally wants those links to open in a new tab instead of the current tab.
- ldjb 8y agoSome websites do use <base target="_blank"> to make links open in a new tab by default. However, this can create a vulnerability as the linked website now has a reference to your site through window.opener and can take the user away from your site: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/ https://www.jitbit.com/alexblog/256-targetblank---the-most-u...