[Project_owners] Firefox sidebar

Silver Surfer silver.surfer444 at gmail.com
Mon Nov 17 07:16:42 PST 2008


 I don't know it'll exactly work but give a try.

Use a preference variable to identify the first launch of browser and let
say you have initialized it to true for identifying the first launch.
You have to specify about the preference variable in another js file. If you
don't know about it, search it in mozilladev.org site.
In overlay.xul, add this script for run the sidebar toggling function on
browser loading.<script type="application/x-javascript">
<![CDATA[

    window.addEventListener("load", initFun, false);
   function initFun(){

       //Get the preference value
       var prefs = Components.classes["@mozilla.org/preferences-service;1"].
                    getService(Components.interfaces.nsIPrefService);
prefs = prefs.getBranch("extensions.yourextensionname.");

        var isFirstLaunch = prefs.getCharPref("firstLaunch");

       if(isFirstLaunch ==  true){
          toggleSidebar('idOfYourSidebarOrBroadcaster');
      }

      prefs.setCharPref("firstLaunch", gContextMenu.imageURL);// set
preference to false


 }


]]>
</script>

I didn't test it. But I think it should work.
On Mon, Nov 17, 2008 at 3:27 PM, manish deora <manish at experiencecommerce.com
> wrote:

> Hi,
>
> i have a query, i have created a sampe firefox sidebar but i want it open
> by default first time after installing it.so how can i capture the firefox
> load event and where should i specify this.
>
> expecting a reply soon.
>
> --
> Regards,
> Manish Deora
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> https://www.mozdev.org/mailman/listinfo/project_owners
>
>


-- 
~Silver Surfer~
Surfing through time & space
http://risingofsilversurfer.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20081117/3d46d09d/attachment.html>


More information about the Project_owners mailing list