-1

I'm trying to make Firefox add-on that could set data to specific text or password field in any web site how could I script this add on ??

ex: I want to log in my Gmail using this add-on where I'll store my account data on it. How I could pass my username and password from my add-on to Gmail website?

I've tried to run this code

 XULSchoolChrome.BrowserOverlay = {


sayHello : function(aEvent) {


let user= document.getElementById("username");
let pass= document.getElementById("passwd");

window.alert("the username is "+ user.getString);
  }
};

I'm running my add-on in yahoo log-in page ...

this the HTML from the site I've get the ID

  • Have you done any research yourself? – WayneC Dec 01 '13 at 13:32
  • yes but I'm totally new in JavaScript ... so I found the solution if the webpage written by me but what if I need to do that with HTML pages that I didn't wrote like : Gmail , Facebook and Twitter ...etc – Khalid Abu El-Soud Dec 01 '13 at 13:41
  • possible duplicate of [How do I write a Firefox Addon?](http://stackoverflow.com/questions/24772/how-do-i-write-a-firefox-addon) – nmaier Dec 02 '13 at 10:53
  • I'm not asking about how to create Firefox Add-on I already pass this part I'm asking **how to write a JavaScript to set or fetch data from text box or password box ** – Khalid Abu El-Soud Dec 02 '13 at 13:29

1 Answers1

0

I found the solution guys you have to use gbrowser as followed

var currenttabIndex = gBrowser.tabContainer.getIndexOfItem(gBrowser.selectedTab);
var currentBrowser = gBrowser.getBrowserAtIndex(currenttabIndex);

var inputElementlist = currentBrowser.contentDocument.getElementsByTagName("input");