views:

1265

answers:

2

I'm learning how to make a firefox extension. I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simple button and script to show you what I have so far. Any light on this subject would be greatly appreciated! Thanks

<script type="application/x-javascript">    
    function loadURL(url) {     

            // I know this part is wrong. How do I load url into main browser??
 window.content.open(url)
    }
</script> 

<button
     id="identifier"
     class="dialog"
     label="Yahoo"
     image="images/image.jpg"
     oncommand="loadURL("http://www.yahoo.com);"/&gt;
+1  A: 

You should be able to access active tab window context in the following way:

function loadURL(url) {  
    content.wrappedJSObject.location = url;
}
Sergey Ilinsky
This was exactly what I needed! Works Perfect. Thanks!!
chris donnelly
A: 

This another method!

document.getElementById('1').loadURI('http://tridz.com')
esafwan