Probably the greatest issues that ever occurred to t he person expertise of the online has been internet extensions. Browsers are highly effective however extensions deliver a brand new stage of performance. Whether or not it is crypto wallets, media gamers, or different fashionable plugins, internet extensions have grow to be important to daily duties.
Engaged on MetaMask, I’m thrust right into a world of constructing all the pieces Ethereum-centric work. A kind of functionalities is guaranteeing 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 prime 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 would like the person to go browser.tabs.replace(tabId, { url: `https://app.ens.domains/${hostname}}` }); } }, { urls:[`*://*.eth/*`], sorts: ['main_frame'], });
Internet extensions present a browser.webRequest.onErrorOccurred
technique that builders can plug into to pay attention 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 can make use of onErrorOccurred
for any variety of causes, however detecting customized hostnames is a good one!
9 Thoughts-Blowing WebGL Demos
As a lot as builders now detest Flash, we’re nonetheless taking part in a little bit of catch as much as natively duplicate the animation capabilities that Adobe’s outdated expertise offered us. After all now we have canvas, an superior expertise, one which I highlighted 9 mind-blowing demos. One other expertise obtainable…
CSS Gradients
With CSS border-radius, I confirmed you ways CSS can bridge the hole between design and growth by including rounded corners to parts. CSS gradients are one other step in that route. Now that CSS gradients are supported in Web Explorer 8+, Firefox, Safari, and Chrome…
CSS Ellipsis Starting of String
I used to be extremely completely happy when CSS
text-overflow: ellipsis
(married with mountedwidth
andoverflow: hidden
was launched to the CSS spec and browsers; the function allowed us to cease attempting to marry JavaScript width calculation with string width calculation and truncation. CSS ellipsis was additionally very pleasant to…