Skip to content

How to make side panel in chrome extension?

I have been learning to create a chrome extension. I have tried hello world example and it was working fine. Now I have been trying to add custom code and make some changes in the hello world code according to my requirements.

What I am trying to create is when the user clicks on the icon in the address bar, it should open popup.html below address bar as shown in the picture. The screenshot is from extension called

They are doing is within chrome extension. When I click on the icon it opens the right drawer on top of the existing webpage and below the address bar to show all my saved bookmarks. I wanted to achieve the same effect but I don’t know where to start. I have heard that there was some experimental side pane but google has removed it. extension


I have taken the suggestions and tried to implement that. Now I am stuck at two places –

  1. How to open the window when clicked on the icon in the address bar. Right now it just opens automatically by itself. I want it open when the user clicks on the icon.
  2. I am doing all this to create a note taking the extension and I have done creating a note-taking extension but it works in popup interface but I wanted to implement in sidebar interface.

Here is my code for –

A. Side Window Interface in Chrome Extension


    "manifest_version": 2,

    "name": "Hello World",
    "description": "This extension to test html injection",
    "version": "1.0",
    "content_scripts": [{
        "run_at": "document_end",
        "matches": [
        "js": ["js/jquery-1.11.3.js", "js/content-script.js"],
        "css": ["css/custom.css"]
    "browser_action": {
        "default_icon": "icon.png"
    "permissions": [

Content Script.js

var iframe = document.createElement('iframe'); = "green"; = "100%"; = "360px"; = "fixed"; = "0px"; = "0px"; = "9000000000000000000";
iframe.frameBorder = "none"; 

B. Note Taking App Extension


<!DOCTYPE html>
<html lang="en">

    <meta charset="utf-8">
    <link rel="stylesheet" href="css/style.css">
    <script src="popup.js"></script>

    <div class="container">
        <div id="toolbar">
          <p id="title">S I D E N O T E S </p> 
          <img id="logo" src="image/icon.png" alt="">
        <div id="all-notes">
            <ul id="todo-items"></ul>
        <div id="take-note">
            <form id="new-todo-form" method="POST" action="#">
                <textarea id="new-todo"></textarea>
                <input type="image" src="image/done.svg" id="submitButton">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/custom.js"></script>
    <script type="text/javascript" src="js/db.js"></script>
    <script type="text/javascript" src="js/app.js"></script>


Screenshot of my app, it works locally enter image description here



There is no right-side panel in chrome extension API.

By you may do it in the same way, as your example extension does:

  1. Create background.js listening messages from the tab
  2. Create a content script sends the message to background.js if the tab is injectable (if you need your extension work correct on system pages)
  3. If tab is injectable, with chrome.tabs.executeScript inject your menu div to the page / inject listener, which opens your menu.
  4. Profit.

More details about how to do it below.

  1. Create background.js listening browser icon clicks and notify your content script about clicks.
  2. Prevent showing of popup.html in default popup.


"browser_action": {
"background": {


  1. In content-script.js create an invisible iframe, with your popup.html (with zero width on with display:none; style). I use zero width because of you may want to animate your menu display by jquery as example extension does.
  2. In content-script add message listener for receive messages sent from background.js script.
  3. When receiving the message, show or hide menu block


chrome.runtime.onMessage.addListener(function(msg, sender){
    if(msg == "toggle"){

var iframe = document.createElement('iframe'); = "green"; = "100%"; = "0px"; = "fixed"; = "0px"; = "0px"; = "9000000000000000000";
iframe.frameBorder = "none"; 
iframe.src = chrome.extension.getURL("popup.html")


function toggle(){
    if( == "0px"){"400px";
  1. Make popup.html and scripts you load from extension context visible for browser HTML context:


"web_accessible_resources": ["popup.html"]

Read more

  1. Chrome Tabs API:
  2. Chrome message passing:
  3. Browser action click processing:
  4. Content script injection:
1 People found this is helpful