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="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml">
<vbox>
<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="" />
</vbox>
<button label="Generate" oncommand="generatePass()" />
<script type="text/javascript">
<![CDATA[
// put some js code here
siteName.value = window.location;
function generatePass() {
//password generating code
}
]]>
</script>
</window>
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. :)