Detecting window load with XUL and running a Javascript function?

I am developing my first addon for Firefox, and I'm using the Extention Developer addon to help me. It has a real time XUL editor which I am using to design my form.

At the moment this is what I have:

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" xmlns="" xmlns:html="" xmlns:h="">
    <label control="masterPassLabel" value="Master password:" />
    <textbox id="masterPass" value="" type="password" />
    <label control="siteNameLabel" value="Site name (defaults to current URL):" />
    <textbox id="siteName" value="" />
<button label="Generate" oncommand="generatePass()" />
<script type="text/javascript">
// put some js code here

siteName.value = window.location;

function generatePass() {
    //password generating code

I want to automatically populate the siteName textbox with the current URL when that form is loaded. And perhaps add some input validation so if there's no page loaded at that time it will show an error?

I'm new to XUL and developing Firefox addons. I have read through a lot of their documents already but I am still learning.

Thanks. :)


Add a function call to the "onload" event attribute of your window.

The following page got me sorted with a similar requirement:

Detecting window load with XUL and running a Javascript function


Need Your Help

correlation of two values in one receive buffer Load runner

winsock loadrunner

I have recorded a script in LR11.5 version using Winsocket protocol (Only protocol I was able to use to record my application). I want to correlate few receive buffers. In one such buffer I have two

MAX function without group by

sql sql-server

I have the following table: