The most effective issues that ever occurred to t he consumer expertise of the online has been internet extensions. Browsers are highly effective however extensions convey a brand new stage of performance. Whether or not it is crypto wallets, media gamers, or different widespread plugins, internet extensions have turn out to be important to day by day duties.
Engaged on MetaMask, I’m thrust right into a world of creating every part Ethereum-centric work. A type of functionalities is guaranteeing that .eth
domains resolve to ENS when enter to the handle 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 would like the consumer to go browser.tabs.replace(tabId, { url: `https://app.ens.domains/${hostname}}` }); } }, { urls:[`*://*.eth/*`], varieties: ['main_frame'], });
Internet 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 may make use of onErrorOccurred
for any variety of causes, however detecting customized hostnames is a good one!
5 Superior New Mozilla Applied sciences You’ve By no means Heard Of
My journey to Mozilla Summit 2013 was unimaginable. I’ve spent a lot time specializing in my undertaking that I had overpassed the entire nice work Mozillians have been placing out. MozSummit offered the right reminder of how sensible my colleagues are and the way a lot…
7 Important JavaScript Features
I bear in mind the early days of JavaScript the place you wanted a easy perform for almost every part as a result of the browser distributors carried out options in another way, and never simply edge options, primary options, like
addEventListener
andattachEvent
. Instances have modified however there are nonetheless a number of features every developer ought to…
Utilizing Dotter for Type Submissions
One of many plugins I am most happy with is Dotter. Dotter permits you to create the standard “Loading…” textual content with out utilizing animated photographs. I am usually requested what a pattern utilization of Dotter can be; type submission create the right scenario. The next…
[ad_2]