for toolbar button click, need url address of active tab.
but
window.gbrowser.selectedbrowser.contentdocument gets cpow error.
how can url location of active tab url within e10s add-on?
looking around @ objects available, , in source code, looks should uri active tab is:
from current nsiuri:
window.gbrowser.currenturi.spec the object window.gbrowser.currenturi returns nsiuri has number of properties uri, including:
[nsiuri].spec //returns string representation of uri. [nsiuri].asciispec //the uri spec ascii compatible encoding. [nsiuri].specignoringref //returns string representation of uri without ref // (part after #) portion. you can nsiuri current selected tab as:
window.gbrowser.selectedbrowser._documenturi from urlbar:
could, of course, pull url out of urlbar:
window.document.getelementbyid('urlbar').value finding window:
of above assume have set window appropriately active window. example, doing like:
// add/remove "/" comment/un-comment code appropriate add-on type. /* add-on sdk: let window = require('sdk/window/utils').getmostrecentbrowserwindow(); //*/ //* overlay , bootstrap (from context/scope): components.utils.import("resource://gre/modules/services.jsm"); //services let window=services.wm.getmostrecentwindow("navigator:browser"); //*/
Comments
Post a Comment