Among the finest issues that ever occurred to t he person expertise of the online has been net 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 in style plugins, net extensions have grow to be important to day by day duties.
Engaged on MetaMask, I’m thrust right into a world of constructing every little thing Ethereum-centric work. A kind of functionalities is making certain 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 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'], });
Net 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!
6 Issues You Didn’t Know About Firefox OS
Firefox OS is everywhere in the tech information and for good motive: Mozilla’s lastly given net builders the platform that they should create apps the best way they have been creating them for years — with CSS, HTML, and JavaScript. Firefox OS has been quickly enhancing…
Create a Dynamic Flickr Picture Search with the Dojo Toolkit
The Dojo Toolkit is a treasure chest of nice JavaScript lessons. You will discover fundamental JavaScript performance lessons for AJAX, node manipulation, animations, and the like inside Dojo. You will discover elegant, useful UI widgets like DropDown Menus, tabbed interfaces, and type ingredient replacements inside…
MooTools Gone Wild: Factor Flashing
If you happen to’re like me and lay awake in mattress at night time, you have flipped on the TV and seen the commercials: misguided, attention-starved school ladies fueled by alcohol ruining their futures by flashing lame camera-men on Spring Break. Why do they do it? Consideration…