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 convey a brand new degree 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 every little thing Ethereum-centric work. A kind of functionalities is guaranteeing that .eth
domains resolve to ENS when enter to the tackle bar. Requests to https://vitalik.eth
naturally fail, since .eth
is not a natively supported high degree area, so we have to intercept this errant request.
// Add an onErrorOccurred occasion through 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 person to go browser.tabs.replace(tabId, { url: `https://app.ens.domains/${hostname}}` }); } }, { urls:[`*://*.eth/*`], varieties: ['main_frame'], });
Internet extensions present a browser.webRequest.onErrorOccurred
methodology 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 superb one!
7 Important JavaScript Features
I bear in mind the early days of JavaScript the place you wanted a easy operate for almost every little thing as a result of the browser distributors applied options otherwise, and never simply edge options, primary options, like
addEventListener
andattachEvent
. Occasions have modified however there are nonetheless a couple of features every developer ought to…
Management Aspect Define Place with outline-offset
I used to be lately engaged on a challenge which featured tables that had been keyboard navigable so clearly utilizing cell outlining through conventional
tabIndex=0
and aspect outlines was an enormous a part of permitting the person navigate rapidly and intelligently. Sadly I ran right into a Firefox 3.6 bug…