with you button example it says:

Error: document.getElementById("browserID").loadURI is not a function

Source File: chrome://browser/content/browser.xul

Line: 1



I just saw that the problem occurs only if the I add my binding, using this
css:

#browserID { -moz-binding:
url("chrome://browser/content/browser.xml#greenfox_browser_bind"); }


And this binding:

> <?xml version="1.0"?>


> <bindings xmlns="http://www.mozilla.org/xbl"; xmlns:xbl="
> http://www.mozilla.org/xbl";

 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>


>  <binding id="greenfox_browser_bind">

 <handlers>

 <handler event="keypress" modifiers="control" keycode="DOM_VK_L">

 <![CDATA[

 var url = window.prompt('Digite o endereço do site:','');

 dump("url = " + url + "\n");

 var browser = document.getElementById("browserID");

 dump("element = " + browser.nodeName + "\n");

 browser.loadURI(url);

 ]]>

 </handler>

 </handlers>

 </binding>


> </bindings>



If I don't add this binding, your example works fine.
Also I tried changing the browser id (in the 3 file), but it still don't
recognize the browser as an element if I add this binding.
Just don't know why.


*
Wellington B. de Carvalho
*


On Thu, Oct 28, 2010 at 4:11 AM, Evgeny <zen...@gmail.com> wrote:

> You can use loadURI from javascript with one argument, just ignore referrer
> and charset untill you really need them.
> browserElement.loadURL("http://www.yahoo.com";)
> Make sure you call loadURI after browser element is loaded, for example on
> window load event or some button click.
>
>
> <?xml version="1.0"?>
> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
>
> <window xmlns="
> http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";>
>
>  <button height="200" label="go to Yahoo"
> oncommand="netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');document.getElementById('browserID').loadURI('
> http://www.yahoo.com')"/>
>
> <browser id="browserID" type="content" src="http://www.google.com.br/";
> flex="1" />
>
> </window>
>
>
>
> I used privilegemanager to test this from xul file loaded in browser, but
> if you writing extension you already have rights
>
>
> On Wed, Oct 27, 2010 at 5:07 PM, Tom Brito <brito....@gmail.com> wrote:
>
>> Hi there!
>>
>> I'm trying to use the function loadURI( uri, referrer, charset 
>> )<https://developer.mozilla.org/en/XUL/Method/loadURI>,
>> but I have low knowledge about web, and I really don't know what does it
>> means with "referrer" and what charset should I use. I think most web sites
>> use UTF-16, right? And what should I pass to "referrer"?
>>
>> I just want to load "google.com".
>>
>> *My Xul file:*
>>
>> <window sizemode="maximized" hidechrome="true" id="browserWindow"
>> title="Window"
>>     onload="window.opener.close();
>> document.getElementById('browserID').focus();"
>>     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul
>> ">
>>     <browser id="browserID" type="content" src="http://www.google.com.br/";
>> flex="1" />
>> </window>
>>
>> *My javascript:*
>>
>> var element = document.getElementById('browserID');
>> dump('element = ' + element.nodeName + '\n');
>> element.loadURI("www.google.com", "", "UTF-16");
>>
>> *The console output:*
>>
>> Error: element.loadURI is not a function
>>
>>
>> *
>>
>> Any hint how to load the page?
>>
>>
>> []s
>>
>> Wellington B. de Carvalho
>> *
>>
>>
>> ------------------------------------------------------------------------------
>> Nokia and AT&T present the 2010 Calling All Innovators-North America
>> contest
>> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
>> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
>> marketing
>> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
>> http://p.sf.net/sfu/nokia-dev2dev
>> _______________________________________________
>> XUL News Wire      - http://xulnews.com
>> XUL Job Postings   - http://xuljobs.com
>> Open XUL Alliance - http://xulalliance.org
>> _______________________________________________
>> xul-talk mailing list
>> xul-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/xul-talk
>>
>>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> XUL News Wire      - http://xulnews.com
> XUL Job Postings   - http://xuljobs.com
> Open XUL Alliance - http://xulalliance.org
> _______________________________________________
> xul-talk mailing list
> xul-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xul-talk
>
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
XUL News Wire      - http://xulnews.com
XUL Job Postings   - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org  
_______________________________________________
xul-talk mailing list
xul-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xul-talk

Reply via email to