I've been having a look at Chrome extensions and I'd like to create an extension that interacts with a web page using a sidebar. So, user clicks button to launch extension, and the current page splits, with the right hand portion displaying my extension. I tried below, but I see nothing (working or otherwise). I'm not overly surprised it's not working as I do not have a sidebar.html file for one thing. The reason I have that in the manifest is because I saw it in another post in this site. The suggestion there was to use the "sidebar" line in manifest.json, but "sidebar" isn't even mentioned in the documentation as being a valid part of the manifest syntax.
manifest.json:
{
"name": "Test 1",
"version": "1.0",
"description": "Test Extension 1",
"page_action": {
"default_icon": "icon.png",
"default_title": "Testing",
"default_popup": "popup.html"
},
"sidebar" : {},
"permissions": [
"experimental"
]
}
popup.html:
<script>
chrome.experimental.sidebar.show();
chrome.experimental.sidebar.expand();
chrome.experimental.sidebar.navigate({path: "sidebar.html"});
</script>
I've enabled 'experimental'.
Thanks for any help.
Click the Extensions button (jigsaw icon) on the URL toolbar. Select the Pin option for Bookmarks Sidebar to add that extension's button to the URL toolbar. Now click the Bookmarks Sidebar extension button to open the new side panel. Right-click a bookmarked page on it to open the context menu shown directly below.
Google has introduced a new sidebar feature to Chrome, which lets you quickly access your bookmarks and reading list while using the desktop version of the browser (via 9to5Google).
The Vtabs Sidebar Press that button to open the sidebar shown below. Press the Tabs button to open a list of tabs open in the browser as above. You can switch between the open tabs in your browser by selecting them there. Click the New tab button on the sidebar to open new tabs.
The problem is that you are opening, theoretically, the sidebar inside your popup, not in the current page.
You should add a content script in the page, with a function that opens the sidebar. So, in your popup you should just retrieve the current tab then call this function from it.
Also, as Boris Smus said in your question, sidebars will be discontinued in future versions. So I advice you to create your own sidebar frame via content scripts.
To help you, I've made a simple extension that create a sidebar on current page.
@Curtis hosted my sample extension on Github, you can clone it here.
I was looking for a sidebar solution as well and ended up at Implement chrome.sidebar API thread.
According to the Sidebar PRD, it is already possible to create sidebar by:
- injecting a script into the page which edits the HTML of the page to display a sidebar by modifying the DOM to insert an iframe which loads the contents of the sidebar from a remote server.
- the injected script can edit the DOM directly to display a sidebar, the contents of which are passed via message.
However, there are many downsides (explained in the same document) with regard to:
Usability, Performance, Security, Privacy (Extension sniffing as well as Third party cookies) and Accessibility.
You can watch a demo of what they are preparing for future Sidebar Component.
It might help in shipping the feature quicker if you star the thread.
Per this comment, Chrome will not get a built-in sidebar component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With