Probably the greatest issues that ever occurred to t he consumer expertise of the net has been internet extensions. Browsers are highly effective however extensions carry a brand new stage of performance. Whether or not it is crypto wallets, media gamers, or different common plugins, internet extensions have turn out to be important to on daily basis duties.
Engaged on MetaMask, I’m thrust right into a world of creating all the pieces Ethereum-centric work. A kind of functionalities is making certain that .eth
domains resolve to ENS when enter to the deal with bar. Requests to https://vitalik.eth
naturally fail, since .eth
is not a natively supported high stage area, so we have to intercept this errant request.
// Add an onErrorOccurred occasion by way of the browser.webRequest extension API browser.webRequest.onErrorOccurred.addListener((particulars) => { const { tabId, url } = particulars; const { hostname } = new URL(url); if(hostname.endsWith('.eth')) { // Redirect to wherever I need the consumer to go browser.tabs.replace(tabId, { url: `https://app.ens.domains/${hostname}}` }); } }, { urls:[`*://*.eth/*`], sorts: ['main_frame'], });
Net extensions present a browser.webRequest.onErrorOccurred
technique that builders can plug into to hear for errant requests. This API does not catch 4**
and 5**
response errors. Within the case above, we search for .eth
hostnames and redirect to ENS.
You might make use of onErrorOccurred
for any variety of causes, however detecting customized hostnames is a good one!
Serving Fonts from CDN
For max efficiency, everyone knows we should put our property on CDN (one other area). Together with these property are customized internet fonts. Sadly customized internet fonts by way of CDN (or any cross-domain font request) do not work in Firefox or Web Explorer (accurately so, by spec) although…
CSS calc
CSS is a whole conundrum; all of us admire CSS due to its simplicity however at all times yearn for the language to do only a bit extra. CSS has developed to accommodate placeholders, animations, and even click on occasions. One drawback we at all times thought…