[xul-interop] Trying to load a URL in Xul browser with javascript

Tom Brito <[email protected]> Wed, 27 Oct 2010 11:07:52 -0200
Newsgroups gmane.comp.lang.xul.general
Message-ID <[email protected]>
--===============4521878055525078471==
Content-Type: multipart/alternative; boundary=0016e65b5e34ea7e47049398ea42

--0016e65b5e34ea7e47049398ea42
Content-Type: text/plain; charset=ISO-8859-1

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
*

--0016e65b5e34ea7e47049398ea42
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"><s=
pan class=3D"Apple-style-span" style=3D"font-family: Arial, &#39;Liberation=
 Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; border-coll=
apse: collapse; line-height: 18px; "><p style=3D"margin-top: 0px; margin-ri=
ght: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-r=
ight: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; b=
order-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; b=
order-style: initial; border-color: initial; font-size: 14px; vertical-alig=
n: baseline; background-image: initial; background-attachment: initial; bac=
kground-origin: initial; background-clip: initial; background-color: transp=
arent; clear: both; word-wrap: break-word; background-position: initial ini=
tial; background-repeat: initial initial; ">

Hi there!</p><p style=3D"margin-top: 0px; margin-right: 0px; margin-bottom:=
 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-botto=
m: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; =
border-bottom-width: 0px; border-left-width: 0px; border-style: initial; bo=
rder-color: initial; font-size: 14px; vertical-align: baseline; background-=
image: initial; background-attachment: initial; background-origin: initial;=
 background-clip: initial; background-color: transparent; clear: both; word=
-wrap: break-word; background-position: initial initial; background-repeat:=
 initial initial; ">

I&#39;m trying to use the function=A0<a href=3D"https://developer.mozilla.o=
rg/en/XUL/Method/loadURI" rel=3D"nofollow" style=3D"margin-top: 0px; margin=
-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; paddin=
g-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px=
; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px=
; border-style: initial; border-color: initial; font-size: 14px; vertical-a=
lign: baseline; background-image: initial; background-attachment: initial; =
background-origin: initial; background-clip: initial; background-color: tra=
nsparent; color: rgb(0, 119, 204); text-decoration: none; cursor: pointer; =
background-position: initial initial; background-repeat: initial initial; "=
>loadURI( uri, referrer, charset )</a>, but I have low knowledge about web,=
 and I really don&#39;t know what does it means with &quot;referrer&quot; a=
nd what charset should I use. I think most web sites use UTF-16, right? And=
 what should I pass to &quot;referrer&quot;?</p>

<p style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-=
left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; paddi=
ng-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom=
-width: 0px; border-left-width: 0px; border-style: initial; border-color: i=
nitial; font-size: 14px; vertical-align: baseline; background-image: initia=
l; background-attachment: initial; background-origin: initial; background-c=
lip: initial; background-color: transparent; clear: both; word-wrap: break-=
word; background-position: initial initial; background-repeat: initial init=
ial; ">

I just want to load &quot;<a href=3D"http://google.com">google.com</a>&quot=
;.</p><p style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 1em; m=
argin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;=
 padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-=
bottom-width: 0px; border-left-width: 0px; border-style: initial; border-co=
lor: initial; font-size: 14px; vertical-align: baseline; background-image: =
initial; background-attachment: initial; background-origin: initial; backgr=
ound-clip: initial; background-color: transparent; clear: both; word-wrap: =
break-word; background-position: initial initial; background-repeat: initia=
l initial; ">

<strong style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; ma=
rgin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; =
padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-b=
ottom-width: 0px; border-left-width: 0px; border-style: initial; border-col=
or: initial; font-size: 14px; vertical-align: baseline; background-image: i=
nitial; background-attachment: initial; background-origin: initial; backgro=
und-clip: initial; background-color: transparent; font-weight: bold; backgr=
ound-position: initial initial; background-repeat: initial initial; ">My Xu=
l file:</strong></p>

</span><blockquote class=3D"webkit-indent-blockquote" style=3D"margin: 0 0 =
0 40px; border: none; padding: 0px;"><span class=3D"Apple-style-span" style=
=3D"font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, s=
ans-serif; font-size: 14px; border-collapse: collapse; line-height: 18px; "=
><font class=3D"Apple-style-span" face=3D"arial"><span class=3D"Apple-style=
-span" style=3D"border-collapse: separate; line-height: normal; font-size: =
small;">&lt;window sizemode=3D&quot;maximized&quot; hidechrome=3D&quot;true=
&quot; id=3D&quot;browserWindow&quot; title=3D&quot;Window&quot;<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">=A0=A0 =
=A0onload=3D&quot;window.opener.close(); document.getElementById(&#39;brows=
erID&#39;).focus();&quot;<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">=A0=A0 =
=A0xmlns=3D&quot;<a href=3D"http://www.mozilla.org/keymaster/gatekeeper/the=
re.is.only.xul">http://www.mozilla.org/keymaster/gatekeeper/there.is.only.x=
ul</a>&quot;&gt;<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">=A0=A0 =
=A0&lt;browser id=3D&quot;browserID&quot; type=3D&quot;content&quot; src=3D=
&quot;<a href=3D"http://www.google.com.br/">http://www.google.com.br/</a>&q=
uot; flex=3D&quot;1&quot; /&gt;<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">&lt;/win=
dow&gt;<br>

<br></span></font></span></blockquote><span class=3D"Apple-style-span" styl=
e=3D"font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, =
sans-serif; font-size: 14px; border-collapse: collapse; line-height: 18px; =
"><p style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margi=
n-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; pad=
ding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bott=
om-width: 0px; border-left-width: 0px; border-style: initial; border-color:=
 initial; font-size: 14px; vertical-align: baseline; background-image: init=
ial; background-attachment: initial; background-origin: initial; background=
-clip: initial; background-color: transparent; clear: both; word-wrap: brea=
k-word; background-position: initial initial; background-repeat: initial in=
itial; ">

<strong style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; ma=
rgin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; =
padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-b=
ottom-width: 0px; border-left-width: 0px; border-style: initial; border-col=
or: initial; font-size: 14px; vertical-align: baseline; background-image: i=
nitial; background-attachment: initial; background-origin: initial; backgro=
und-clip: initial; background-color: transparent; font-weight: bold; backgr=
ound-position: initial initial; background-repeat: initial initial; ">My ja=
vascript:</strong></p>

</span><blockquote class=3D"webkit-indent-blockquote" style=3D"margin: 0 0 =
0 40px; border: none; padding: 0px;"><span class=3D"Apple-style-span" style=
=3D"font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, s=
ans-serif; font-size: 14px; border-collapse: collapse; line-height: 18px; "=
><font class=3D"Apple-style-span" face=3D"arial"><span class=3D"Apple-style=
-span" style=3D"border-collapse: separate; line-height: normal; font-size: =
small;">var element =3D document.getElementById(&#39;browserID&#39;);<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">dump(&#3=
9;element =3D &#39; + element.nodeName + &#39;\n&#39;);<br>

</span></font></span><span class=3D"Apple-style-span" style=3D"font-family:=
 Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-=
size: 14px; border-collapse: collapse; line-height: 18px; "><font class=3D"=
Apple-style-span" face=3D"arial"><span class=3D"Apple-style-span" style=3D"=
border-collapse: separate; line-height: normal; font-size: small;">element.=
loadURI(&quot;<a href=3D"http://www.google.com">www.google.com</a>&quot;, &=
quot;&quot;, &quot;UTF-16&quot;);<br>

<br></span></font></span></blockquote><span class=3D"Apple-style-span" styl=
e=3D"font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, =
sans-serif; font-size: 14px; border-collapse: collapse; line-height: 18px; =
"><p style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margi=
n-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; pad=
ding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bott=
om-width: 0px; border-left-width: 0px; border-style: initial; border-color:=
 initial; font-size: 14px; vertical-align: baseline; background-image: init=
ial; background-attachment: initial; background-origin: initial; background=
-clip: initial; background-color: transparent; clear: both; word-wrap: brea=
k-word; background-position: initial initial; background-repeat: initial in=
itial; ">

<strong style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; ma=
rgin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; =
padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-b=
ottom-width: 0px; border-left-width: 0px; border-style: initial; border-col=
or: initial; font-size: 14px; vertical-align: baseline; background-image: i=
nitial; background-attachment: initial; background-origin: initial; backgro=
und-clip: initial; background-color: transparent; font-weight: bold; backgr=
ound-position: initial initial; background-repeat: initial initial; ">The c=
onsole output:</strong></p>

</span><blockquote class=3D"webkit-indent-blockquote" style=3D"margin: 0 0 =
0 40px; border: none; padding: 0px;"><span class=3D"Apple-style-span" style=
=3D"font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, s=
ans-serif; font-size: 14px; border-collapse: collapse; line-height: 18px; "=
><font class=3D"Apple-style-span" face=3D"arial"><span class=3D"Apple-style=
-span" style=3D"border-collapse: separate; line-height: normal; font-size: =
small;">Error: element.loadURI is not a function</span></font></span></bloc=
kquote>

<div><br></div><i><div style=3D"text-align:left"><span class=3D"Apple-style=
-span" style=3D"font-style: normal;"><br></span></div><div style=3D"text-al=
ign:left"><span class=3D"Apple-style-span" style=3D"font-style: normal;">An=
y hint how to load the page?</span></div>

<div style=3D"text-align:left"><span class=3D"Apple-style-span" style=3D"fo=
nt-style: normal;"><br></span></div><div style=3D"text-align:left"><span cl=
ass=3D"Apple-style-span" style=3D"font-style: normal;"><br></span></div><di=
v style=3D"text-align:left">

<span class=3D"Apple-style-span" style=3D"font-style: normal;">[]s</span></=
div><div style=3D"text-align:left"><span style=3D"font-style:normal"><i><br=
></i></span></div><div style=3D"text-align:left"><span style=3D"font-style:=
normal"><i>Wellington B. de Carvalho</i></span></div>

</i><br>

--0016e65b5e34ea7e47049398ea42--


--===============4521878055525078471==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
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
--===============4521878055525078471==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
XUL News Wire      - http://xulnews.com
XUL Job Postings   - http://xuljobs.com
Open XUL Alliance - http://xulalliance.org  
_______________________________________________
xul-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xul-talk

--===============4521878055525078471==--