MozillaZine

Creating sidebar

From MozillaZine Knowledge Base

(Difference between revisions)
Revision as of 16:33, 22 September 2005
Ihoss (Talk | contribs)

<-- Previous diff
Revision as of 19:48, 22 September 2005
Asqueella (Talk | contribs)
(category)
Next diff -->
Line 28: Line 28:
Thanks to mozedit for this code Thanks to mozedit for this code
 +
 +[[Category:Example code]]

Revision as of 19:48, 22 September 2005

This is how to open a sidebar using javascript and xul. The first file is the xul file:

<broadcasterset id="mainBroadcasterSet">
	<broadcaster id="nameofSidebar"
		autoCheck="false"
		label="label"
		type="checkbox" 
		group="sidebar"
		sidebarurl=""
		sidebartitle="title"
		oncommand="openSidebar();"/>
</broadcasterset>
<popup id="contentAreaContextMenu">
	<menuitem id="openSideBar"
               label="Open Sidebar"
               accesskey=""
               oncommand="openSidebar();"/>
</popup>

Here is the js file:

function openSidebar(){
	var url="The url, chrome or http";
	var sidebar = document.getElementById('nameofSidebar')
	sidebar.setAttribute('sidebarurl',url);
	toggleSidebar('nameofSidebar');
}

Thanks to mozedit for this code