[Project_owners] urlBar Listener

eric.jung at yahoo.com eric.jung at yahoo.com
Thu Jul 5 08:00:39 PDT 2007


OK, how about document.location.href="chrome://myextension/content/mypage.html"
If document is null, use this code to get the document to change its location:

http://developer.mozilla.org/en/docs/Code_snippets:Tabbed_browser#Enumerating_tabs



----- Original Message ----
From: joe ertaba <belaviyo at gmail.com>
To: Mozdev Project Owners List <project_owners at mozdev.org>
Sent: Thursday, July 5, 2007 8:48:11 AM
Subject: Re: [Project_owners] urlBar Listener

it is good idea but maybe it is not selected tab.

i want some code to be able to change url if tab is not selected too.

any idea about some change on above code i sent ?



On 7/5/07, eric.jung at yahoo.com <eric.jung at yahoo.com> wrote:
To change the url of the currently selected tab I think you can manipulate the 
location.href of gBrowser.selectedTab.


----- Original Message ----
From: joe ertaba <
belaviyo at gmail.com>
To: 
project_owners at mozdev.org
Sent: Thursday, July 5, 2007 4:10:52 AM
Subject: [Project_owners] urlBar Listener

hi gays

i need to show some local file instead original url when user dont set font size of current page.

so i need to change tab url by:



var myExt_urlBarListener = {
  QueryInterface: function(aIID)
  {


   if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
       aIID.equals(Components.interfaces.nsISupportsWeakReference

) ||
       aIID.equals(Components.interfaces.nsISupports))
     return this;

   throw Components.results.NS_NOINTERFACE;
  },



  onLocationChange: function(aProgress, aRequest, aURI)
  {


    myExtension.processNewURL(aURI);
  },



  onStateChange: function() {},
  onProgressChange: function() {},
  onStatusChange: function() {},

  onSecurityChange: function() {},
  onLinkIconAvailable: function() {}


};

var myExtension = {


  oldURL: null,
  
  init: function() {


    // Listen for webpage loads
    gBrowser.addProgressListener(myExt_urlBarListener,


        Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
  },
  


  uninit: function() {
    gBrowser.removeProgressListener(myExt_urlBarListener);


  },

  processNewURL: function(aURI) {
    if (
aURI.spec == this.oldURL)
      return;
    

    // now we know the url is new...

    alert(aURI.spec);
    this.oldURL = aURI.spec;


  }
};



window.addEventListener("load", function() {myExtension.init()}, false);

window.addEventListener("unload", function() {myExtension.uninit()}, false);



any body can help me? 
is it possible to change tab url directly or i must find tab index first and then change it ?




_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org

http://mozdev.org/mailman/listinfo/project_owners








_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org

http://mozdev.org/mailman/listinfo/project_owners




_______________________________________________
Project_owners mailing list
Project_owners at mozdev.org
http://mozdev.org/mailman/listinfo/project_owners




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070705/891b8f33/attachment.html 


More information about the Project_owners mailing list