<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by consious_coder on Medium]]></title>
        <description><![CDATA[Stories by consious_coder on Medium]]></description>
        <link>https://medium.com/@varaprasadh?source=rss-45b511263ded------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*XjWY0pBWfT5YZ_MlBBv4UA.jpeg</url>
            <title>Stories by consious_coder on Medium</title>
            <link>https://medium.com/@varaprasadh?source=rss-45b511263ded------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 12:44:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@varaprasadh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Send Multipart Form Data Requests using Java Native HttpClient]]></title>
            <link>https://varaprasadh.medium.com/how-to-send-multipart-form-data-requests-using-java-native-httpclient-989f6921dbfa?source=rss-45b511263ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/989f6921dbfa</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[consious_coder]]></dc:creator>
            <pubDate>Sat, 11 Mar 2023 14:46:43 GMT</pubDate>
            <atom:updated>2023-03-11T14:46:43.279Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*On946TYyRWMfg4VVUZO_Kw.png" /><figcaption>a boy with specs</figcaption></figure><p>In my previous post, we discussed the basics of multipart/form-data and how it&#39;s used for sending data through HTTP POST requests, especially for file uploads. In this post, we&#39;ll explore how to send multipart/form-data requests in Java using the built-in HttpClient class.</p><p>I strongly recommend checking out my previous post and coming back here.</p><p><a href="https://varaprasadh.medium.com/what-the-heck-is-multipart-form-data-8df091d598b5">what the heck is multipart/form-data???</a></p><p>Before we start, make sure you have at least Java 11 installed, which includes the java.net.http package with the HttpClient class.</p><p>Java’s HttpClient is a powerful tool for making HTTP requests, but it lacks a built-in way to handle multipart form data requests. Multipart form data requests are commonly used when sending data that includes binary data such as files or images. In this article, we will show you how to build your own multipart form data handler using Java’s HttpClient.</p><p>HttpClient allows ByteArraybody handler <strong>but doesn’t provide a way to handle both textual form data and file uploads</strong> and send them. So we are going to build our own multipart body handler</p><p>you might want something which looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yMCMxiQhx7REX4yu8pnG9w.png" /></figure><p>No problem, we are going to build that `HTTPRequestMultipartBody`</p><p>In general, we extensively work with JSON rest APIs and mostly work with JSON data but multipart/form-data requests are something that we usually don’t handle, we let some library / API do for us. so we going to see what’s happening under the hood.</p><p>we have to parse the user form data parameters and files into the multipart body which deals with boundaries and all. the body looks like below</p><pre><br>        --------------------------abcdef1234567890<br>        Content-Disposition: form-data; name=&quot;name&quot;<br><br>        John Doe<br>        --------------------------abcdef1234567890<br>        Content-Disposition: form-data; name=&quot;email&quot;<br><br>        johndoe@example.com<br>--------------------------abcdef1234567890<br>        Content-Disposition: form-data; name=&quot;profile_picture&quot;; filename=&quot;picture.jpg&quot;<br>        Content-Type: image/jpeg<br><br>&lt;binary data for the image&gt;<br>        --------------------------abcdef1234567890--</pre><p><strong>What is that!!!!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*wMiFbZW2lCIz2Hq-4TV3MQ.png" /><figcaption>meme</figcaption></figure><p>That is how the request body looks once every field and file is parsed.</p><p>No worries, I got you! watch the below magic</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VqyLJ1LSNvHjpsbb2SXCtA.png" /></figure><p>we are generating the previously shown request body with the above code. it generates a boundary which defines where the content started and ended. finally, everything becomes a byteArray which HttpClient can accept.</p><p>Here is the Gist of the whole implementation of the multipart body handler</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d9ebf2243f5e4029746bc8811465383/href">https://medium.com/media/7d9ebf2243f5e4029746bc8811465383/href</a></iframe><p><strong>Usage</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91fa6ae45c577417b06f2ae6fab09865/href">https://medium.com/media/91fa6ae45c577417b06f2ae6fab09865/href</a></iframe><p>I hope this will help you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*De7P5fAH9xQPzBGu17JVrg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=989f6921dbfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[what the heck is multipart/form-data???]]></title>
            <link>https://varaprasadh.medium.com/what-the-heck-is-multipart-form-data-8df091d598b5?source=rss-45b511263ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/8df091d598b5</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[multipart-form-data]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[consious_coder]]></dc:creator>
            <pubDate>Wed, 08 Mar 2023 18:12:25 GMT</pubDate>
            <atom:updated>2023-03-11T15:00:22.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zervWeaeE3imm9NC87NFkA.png" /><figcaption>a image of boy turning head around to get this done</figcaption></figure><blockquote><strong><em>TL;DR</em></strong></blockquote><blockquote>This blog discusses the importance of multipart/form-data in web development, which is used for uploading files and sending data through an HTTP POST request. Understanding multipart/form-data is essential for web developers working with file uploads while JSON couldn&#39;t help</blockquote><p>When it comes to web development, understanding HTTP content types is critical. One of the most important content types to be aware of is multipart/form-data. This format is used for uploading files and sending other data through an HTTP POST request.</p><p>When you submit a form with multiple fields and file inputs, you’re likely using multipart/form-data, whether you&#39;re aware of it or not (especially if you&#39;re using libraries to handle it). This content type is essential for sending different types of data in a single HTTP POST request.</p><p>While JSON is an excellent format for sending structured data, it can’t handle file uploads. That’s where multipart/form-data comes in - it tells the server that you&#39;ll be sending different types of data in a single request.</p><p>When using multipart/form-data, we define the request like this:</p><p>Content-Type: multipart/form-data; boundary= — &lt;any random string&gt;</p><p><strong>But what’s that “boundary” part all about?</strong></p><p>When we send different pieces of information in a single request body, the server needs to know where the start and end of each piece of data is located. That’s where the boundary (or separator) comes in — it divides the information so the server can parse it correctly.</p><p>So how does it work? Let’s say you’re uploading a profile picture and filling out a form with your name and email address. When you submit the form, the data is sent to the server in multipart/form-data format, with the picture and form data separated by the boundary.</p><p>Understanding multipart/form-data and how to use it properly is crucial for any web developer working with file uploads. It allows you to create more robust, user-friendly web applications.</p><p>Let&#39;s see the difference between Content-Type:application/json` vs Content-Type: multipart/form-data`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*D7SpMXb_y-ZBPcbnUr8tDw.png" /><figcaption>content-type:application/json</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*AfckY5BZA2hL5EY0aFDQlg.png" /><figcaption>content-type: multipart/form-data</figcaption></figure><p>in multipart form data, we can send any kind of file and data. we would have to provide the proper content type for each of the items in the request body.</p><p>in the above example. we have attributes name,email,profile_picture and the content type for each of the attributes has to be defined so that the server could parse the items back.</p><p>In conclusion, multipart/form-data is a critical HTTP content type for uploading files and sending other data through an HTTP POST request. With a good understanding of this format and how to use it, you can create better web applications with more robust file upload functionality.</p><p><strong>Thank you!!!</strong></p><p><strong>you might also like the follow-up blog on sending multipart requests using a java 11 HTTP client, check the post below</strong></p><p><a href="https://varaprasadh.medium.com/how-to-send-multipart-form-data-requests-using-java-native-httpclient-989f6921dbfa">How to Send Multipart Form Data Requests using Java Native HttpClient</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8df091d598b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build your chrome extension with react, typescript using webpack]]></title>
            <link>https://varaprasadh.medium.com/build-your-chrome-extension-with-react-typescript-using-webpack-5d5574084dff?source=rss-45b511263ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d5574084dff</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <dc:creator><![CDATA[consious_coder]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 12:34:03 GMT</pubDate>
            <atom:updated>2021-06-03T12:49:23.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*08_4W1LZuSVWswIkLZqwPg.jpeg" /><figcaption>chrome legend</figcaption></figure><p>Hi, I’m Varaprasadh, in this article we are going to build a chrome extension using react, typescript with minimal webpack config.</p><p>TL:DR; clone this repo and start working</p><p><a href="https://github.com/alienship/chrome-extension-webpack-boilerplate">alienship/chrome-extension-webpack-boilerplate</a></p><p>you can check out how i built my extension with this setup here</p><p><a href="https://github.com/varaprasadh/cursors-v2">varaprasadh/cursors-v2</a></p><p>you can try out the extension at</p><p><a href="https://chrome.google.com/webstore/detail/cursors/finlildobfdjhkemcieihnkgmgoikgan">cursors</a></p><p>I’m assuming that you know components of a chrome extension like what is background script, content script, URL override page (new tab page)</p><p>we are going to override the default new page, I&#39;m gonna show “hello world for now”, something like below</p><figure><img alt="new tab page" src="https://cdn-images-1.medium.com/max/648/1*ZYewWl2fWBs64Qc0xvHicQ.png" /></figure><p>The snippet for the above page is below, it’s a tiny component, but you can do a lot. something like <a href="https://chrome.google.com/webstore/detail/cursors/finlildobfdjhkemcieihnkgmgoikgan">https://chrome.google.com/webstore/detail/cursors/finlildobfdjhkemcieihnkgmgoikgan</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca08e8f00a0a66c134c2fb13e1af7213/href">https://medium.com/media/ca08e8f00a0a66c134c2fb13e1af7213/href</a></iframe><p>let’s jump into the actual process, let me show you the directory structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*HXr719_E43VjhUhYhyNcig.png" /></figure><p>and extension’s manifest.json will look like</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89b4b9cb3d136a62aacda2adbd264b26/href">https://medium.com/media/89b4b9cb3d136a62aacda2adbd264b26/href</a></iframe><p>#1 public directory contains the HTML templates for the popup, new tab, options page so that we could inject our react app into them later</p><p>#2 let’s see the webpack config, first of all, we require below dev dependencies, see below package.json for reference</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a69577725b5bd6d45fbd23123d3adb0/href">https://medium.com/media/2a69577725b5bd6d45fbd23123d3adb0/href</a></iframe><p>and webpack config looks something like</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7272a6c7c9dde472c3f54a15b8ed60f1/href">https://medium.com/media/7272a6c7c9dde472c3f54a15b8ed60f1/href</a></iframe><p>we provide entry points to our tsx files ie, newtab.tsx, background and they will get transpiled and added into dist directory with the same as there is <br>output: { fileName: [name].js }</p><p>we have ts-loader for parsing ts,tsx files and css-loader for styles and file-loader to load up assets</p><p>coming to plugins we have html-webpack-plugin that will inject out respected js files into html files, in this case i’m injecting newTab.tsx code into newtab.raw.html and that will add that file into the /dist as newtab.html</p><p>copy-webpack-plugin will copies the contents of public dir to /dist dir so that our manifest.json and other files goes into /dist</p><p>clean-webpack-plugin cleans up the /dist everytime there is new build</p><p>just run npm build that will do the transpiling and dist folder will be created.</p><p>Load up the dist dir into chrome as extension root dir and we are done,</p><p>use this boilerplate for reference,</p><p><a href="https://github.com/alienship/chrome-extension-webpack-boilerplate">alienship/chrome-extension-webpack-boilerplate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d5574084dff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Reactive UI with Plain Javascript]]></title>
            <link>https://varaprasadh.medium.com/build-reactive-ui-with-plain-javascript-180085998756?source=rss-45b511263ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/180085998756</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[js]]></category>
            <dc:creator><![CDATA[consious_coder]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 07:42:06 GMT</pubDate>
            <atom:updated>2020-04-17T07:42:06.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HpWJeDfgjrSlw3yzjcEztA.png" /></figure><p>in this article we are going to learn about reactive components,and how to deal with updating UI when state of component changes!</p><p><strong>what is meant by reactivity when coming to UI?<br></strong>in general an app may have a particular state/data right!, we need to keep on update our UI when state changes, in case of some libraries/frameworks they have built in ecosystem, that updates ui when state changes, <br>in plain vanilla javascript we do like<br>let’s take an example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*iolkNH4pgJ08fAlfPS7lIw.png" /></figure><p>as per the above code snippet, we just get some data from api and saving it into the state and rendering ui, upto this it’s perfect, but what if we have data that changes continuously, then we required to explicitly re-render ui</p><p>so here reactivity comes into picture, when state changes there should be a trigger that does whatever tasks we wanted to do with the updated state.</p><blockquote>but we can get rid of this,we have powerful javascript features called proxy and closures</blockquote><p><strong>Our goal is to transform normal state into observable/reactive state that riggers changes in our ui</strong></p><h3>let’s get started</h3><p>let’s say we have some DOM container that is nothing but a normal HTMLElement with some identifier like class,id,..etc and it may has few properties like innerHTML,textContent, value,..etc, that’s where we are gonna show state data,<br>it’s kind of two way data binding, the target HTML element might be anything,</p><p>let me quickly explain with the code snippet, btw, this code snippet works similar to react hooks.</p><p>closures are powerful js feature that enables inner function to access its parent’s member variables and functions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*D7c0pQvEiW4B7sd_yKuy0w.png" /></figure><p>i decided to ‘make a <strong>initial function as closure</strong> that takes few parameters like <strong>initial value for the state</strong>, and <strong>selector for HTML Elemen</strong>t and <strong>property to be monitored</strong> on.<br>it<strong> returns an array/tuple of functions</strong> getVal returns the current value of the state and setVal(newVal) sets a new value to the state.</p><p><strong>how we can use it?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*YN3OucL5D9MBt_QwVnsU_A.png" /></figure><p>so here is the markup that has a &lt;div&gt; with class container</p><p>we can initialize our observable using the <strong>closurehook</strong> we previously made as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*Uub9UBSHEKpMljtlEq93Qw.png" /></figure><p>we get’s two functions from our not awesome <strong>useClosureHook</strong> by array destructuring. we can just invoke them as normal functions,rendering is taken by closurehook itself so we can just focus on setting/getting state data.</p><p>the same can be done using proxy but Currently, proxy support is implemented in Node and all current browsers, with the exception of Internet Explorer 11.</p><p><strong>ES6 proxies</strong> sit between your code and an object. A proxy allows you to perform meta-programming operations such as intercepting a call to inspect or change an object’s property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*Gx1tXhw52GoJHkptudzuYw.png" /></figure><p>let’s Test our both strategies as they work similar</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*9K9LimM1Cay2LSUQ9Mnv4w.png" /></figure><p>so here, we are giving “ “ as inital value and css selector and property we are setting is “innerHTML”</p><p>i’m continuously updating state variables using <strong>setInterval</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*cVxa3tIFnXJHORdR4PPV9g.png" /></figure><p>and here is the <strong>final output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*QrBNTMylIi7CylOZGRKcCA.gif" /></figure><p>instead manual setting a tightly coupled functionality in the hook<br>we can pre configure it with the callback</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*hdPe6Sa42yFV80z5xq0G0A.png" /></figure><p>we can do a lot with <strong>closures</strong> and <strong>proxies</strong></p><p>checkout these</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">MDN docs on es6 Proxy</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures">javascript closures</a></p><blockquote>Thank you for reading this,I’M noob blogger, your feedback can helps me a lot!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=180085998756" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Build A Chrome Extension That Shows Customized New Tab Page.]]></title>
            <link>https://varaprasadh.medium.com/lets-build-a-chrome-extension-that-shows-customized-new-tab-page-5414e317f2b8?source=rss-45b511263ded------2</link>
            <guid isPermaLink="false">https://medium.com/p/5414e317f2b8</guid>
            <category><![CDATA[chrome]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[browser-extension]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[consious_coder]]></dc:creator>
            <pubDate>Sun, 12 Apr 2020 07:21:48 GMT</pubDate>
            <atom:updated>2020-04-12T07:21:48.212Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*neyQZ2xVefM82nCsFNEu_w.png" /></figure><blockquote>have you ever felt bored of seeing browser’s default new tab page, or using someone else’s tool or themes?</blockquote><p>No Problem, Now you can build your own after going through this tutorial</p><h3>Prerequisites</h3><ul><li>you should have basic html and javascript knowledge.</li></ul><p><strong>so,what we are going to do?</strong></p><ul><li>a basic html web page that shows a search bar and grid of most recently visited sites</li><li>and making it as a chrome extension by including it in a manifest</li><li>loading the extension into browser</li></ul><blockquote>To Get the Source Code for this project<a href="https://github.com/varaprasadh/hello_world"> Click here</a></blockquote><p><strong>Let’s get started</strong></p><p>first of all let’s project structure of our extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*DSe79fOeQN0G_g-wgP-w3w.png" /></figure><ul><li><strong>addon folder</strong> is our root folder, it contains <br><em> </em>- <strong>css folder/ — </strong>it contains all the stylesheets required for the extension pages<br>- <strong>manifest.json-</strong> is the main entry file of extension, it has all permissions and properties of the extension that we need to define in it as per the requirement.<br>-<strong> js folder/ — </strong>contains javascript files.<br>- <strong>images/</strong> — of course, it contains images<br>- <strong>newTab.html</strong> is the page we are going embed into browser.</li></ul><p>Let’s quickly look into manifest.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-TyVka3Dzf-cbRR9KaXgIw.png" /><figcaption>manifest.json</figcaption></figure><p><strong>version</strong> is the normal version code as every application needs to identify updates, in our case it’s 1.0 , in case you want to update the extension in the store set it to higher than it was.</p><p><strong>manifest_versio</strong>n is the version of extension api’s manifest, <em>currently it’s 2</em>, in future it may change.</p><p>set a<strong> name</strong> to the extension and add relevant description to it.</p><p>set the<strong> icons</strong> of extension, we can observe them in store and chrome://extensions . we need to set it in 3 different resolutions as 128px,48px,16px, for this tutorial we will use same icon.</p><p>extension icon can be visible at top right corner of the browser after setting <strong>browser_action default_icon</strong>. this property also needs three resolutions of the icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/161/1*hFaK6iuHwTJBnb3-WvuZjg.png" /><figcaption>top right corner of the browser</figcaption></figure><p>by setting<strong> chrome_url_overrides</strong> <strong>-&gt;</strong> <strong>newtab </strong>property we can replace the default browser newtab page with our customized page.<br>to show the most visited sites we need a <strong>permission</strong> called <strong>topSites</strong>, so we need to define it in permissions.</p><p><strong>And that’s the Setup let’s dig into newTab.html</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iGE0eR4oNdewnK8kx45yRQ.png" /></figure><p>that’s the markup for our page, if it’s hard to read here,checkout github link provided above, and download the project</p><blockquote><em>images and required files mentioned in this markup are available in the github repo above</em></blockquote><p>we will have a <em>search bar</em> so we can enter something in it and make a query to google</p><p><strong>And coming to main part the newTab.js is</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*xbIWfuFKUnqjAmNpbUTdpA.png" /><figcaption>newtab.js</figcaption></figure><p>initialize references to markup elements and add required event listeners on window load.</p><ul><li>when search icon is clicked or enter is pressed it makes query to google</li><li><strong>newTab.search()</strong> is gets the value from the search bar and trims and sets the current window’s location,that automatically refreshes as per the query.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*gJHazZpZcOrjA-_SwMaM9Q.png" /></figure><p><strong>let’s see how to show listing of most visited sites</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*Y8f2LUB6qvYqfwtNQcfYsQ.png" /></figure><p>we can send a callback to <strong>chrome.topSites.get(callback)</strong> and it passes topsites as an array of objects and each object contains <strong>{ title of the site, url of the site, ..addition properties}</strong></p><p>what’s happening over there is →for each site we are making a card component and appending it to the list container.</p><h3><strong>That’s it! now Load it in Browser!</strong></h3><p>open <strong>chrome://extensions </strong>in your browser</p><p>and enable developer mode by toggling switch at top right corner of the window. after that you can see three options at top left corner of that same window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*nnir_qMJEvP1eJcw_8RALA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*odLF5JF-ghRKdH5hw440FA.png" /></figure><p>click on <strong>load unpacked</strong> and it open file dialogue, select our project root directory and <strong>click open</strong>.if everything is fine then you can see card item like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*oJoqJHIFBGPd3eUHVeNqcg.png" /><figcaption>loaded extension on chrome://extensions</figcaption></figure><p>now open new tab, Boom, now its displays our webpage instead of default boring one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvJksoN9iDVNNJ8w1stFlg.png" /></figure><p><strong>what’s next?</strong></p><ul><li>if you not like this design replace newtab.html with your awesome design and reload the extension,</li></ul><blockquote>get the <a href="https://github.com/varaprasadh/hello_world">Source Code for this Project</a></blockquote><p><strong>Follow me for more Content like this</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5414e317f2b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>