<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Current URL in FireFox</title>
	<atom:link href="http://blog.xkoder.com/2006/11/30/current-url-in-firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/</link>
	<description>therez light</description>
	<lastBuildDate>Wed, 01 Feb 2012 18:52:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-10</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Thu, 08 Oct 2009 11:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-10</guid>
		<description>Worked like a charm. You&#039;re my hero. Thank you very much. I&#039;ll definitely recommend your blog :p Farewell!</description>
		<content:encoded><![CDATA[<p>Worked like a charm. You&#8217;re my hero. Thank you very much. I&#8217;ll definitely recommend your blog :p Farewell!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xk0der</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-9</link>
		<dc:creator>xk0der</dc:creator>
		<pubDate>Thu, 08 Oct 2009 09:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-9</guid>
		<description>@nik: My bad :) .. I had read it twice and that thing appeared to me as &quot;addEventListener&quot; instead of addEventHandler :), maybe coz it was midnight at my place :D

Good to hear that you got it working. As for the tab labels, try this as a starting point:

Put the following line inside the if() block in the myHandler()  function.

if(..)
{
....
gBrowser.selectedTab.label = &quot;My New Label&quot;;
....
}

Look here for more information:
https://developer.mozilla.org/en/XUL/tabbrowser</description>
		<content:encoded><![CDATA[<p>@nik: My bad <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .. I had read it twice and that thing appeared to me as &#8220;addEventListener&#8221; instead of addEventHandler <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , maybe coz it was midnight at my place <img src='http://blog.xkoder.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Good to hear that you got it working. As for the tab labels, try this as a starting point:</p>
<p>Put the following line inside the if() block in the myHandler()  function.</p>
<p>if(..)<br />
{<br />
&#8230;.<br />
gBrowser.selectedTab.label = &#8220;My New Label&#8221;;<br />
&#8230;.<br />
}</p>
<p>Look here for more information:<br />
<a href="https://developer.mozilla.org/en/XUL/tabbrowser" rel="nofollow">https://developer.mozilla.org/en/XUL/tabbrowser</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-8</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Wed, 07 Oct 2009 16:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-8</guid>
		<description>I did it! Or rather, you did. addEventHandler had to be addEventListener. That did the trick. Man, thank you so much. You wouldn&#039;t believe how much time I&#039;ve already spent figuring this thing out. Now the only thing left for me to find out is how I can do the same thing with tab labels. The &quot;(Untitled)&quot; ain&#039;t too pretty either and var obj = document.getElementById(&quot;tabbrowser-tab&quot;); doesn&#039;t do the trick yet. Sorry for leaving such a mess in your comments btw. Feel free to remove them if you like. Again, thank you very much! You&#039;ve been of great help.</description>
		<content:encoded><![CDATA[<p>I did it! Or rather, you did. addEventHandler had to be addEventListener. That did the trick. Man, thank you so much. You wouldn&#8217;t believe how much time I&#8217;ve already spent figuring this thing out. Now the only thing left for me to find out is how I can do the same thing with tab labels. The &#8220;(Untitled)&#8221; ain&#8217;t too pretty either and var obj = document.getElementById(&#8220;tabbrowser-tab&#8221;); doesn&#8217;t do the trick yet. Sorry for leaving such a mess in your comments btw. Feel free to remove them if you like. Again, thank you very much! You&#8217;ve been of great help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-7</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Wed, 07 Oct 2009 15:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-7</guid>
		<description>Ugh, you see I don&#039;t really know what I&#039;m doing here which doesn&#039;t make it easy. I didn&#039;t have a handler. I sort of based my script on another one I found online that gathered all menus, i.e. File, Edit, ... in one. A compact menu so to say. And that script didn&#039;t use a handler either. The menu was permanently replaced. Might be cause it&#039;s sort of a static thing. The menu doesn&#039;t change, unlike the url which is why you need a handler. Makes perfect sense.

Unfortunately it still doesn&#039;t work with the lines you posted above. I&#039;m really sorry for taking up your time with this issue, but I really don&#039;t know where else I could get help from. I already posted on two boards about it, but I guess the issue is a little too abstract for people to take interest in it :/</description>
		<content:encoded><![CDATA[<p>Ugh, you see I don&#8217;t really know what I&#8217;m doing here which doesn&#8217;t make it easy. I didn&#8217;t have a handler. I sort of based my script on another one I found online that gathered all menus, i.e. File, Edit, &#8230; in one. A compact menu so to say. And that script didn&#8217;t use a handler either. The menu was permanently replaced. Might be cause it&#8217;s sort of a static thing. The menu doesn&#8217;t change, unlike the url which is why you need a handler. Makes perfect sense.</p>
<p>Unfortunately it still doesn&#8217;t work with the lines you posted above. I&#8217;m really sorry for taking up your time with this issue, but I really don&#8217;t know where else I could get help from. I already posted on two boards about it, but I guess the issue is a little too abstract for people to take interest in it :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xk0der</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-6</link>
		<dc:creator>xk0der</dc:creator>
		<pubDate>Wed, 07 Oct 2009 15:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-6</guid>
		<description>When are you calling your function? I guess you haven&#039;t tied it to any event.

You probably need to do something like this:
/**/
function myHandler () {
var obj = document.getElementById(”urlbar”);
if(obj.value == “file:///D:/Modding/startpage/home.htm”) {
obj.value = “brap”;
}
}

gBrowser.addEventHandler(&quot;TabSelect&quot;, myHandler, true);
/**/

So your function &#039;myHandler&#039; would get fired up every-time the user selects a Tab. You probably want to tie your handler to more events than just the TabSelect event. This may help: https://developer.mozilla.org/en/Code_snippets/Tabbed_browser</description>
		<content:encoded><![CDATA[<p>When are you calling your function? I guess you haven&#8217;t tied it to any event.</p>
<p>You probably need to do something like this:<br />
/**/<br />
function myHandler () {<br />
var obj = document.getElementById(”urlbar”);<br />
if(obj.value == “file:///D:/Modding/startpage/home.htm”) {<br />
obj.value = “brap”;<br />
}<br />
}</p>
<p>gBrowser.addEventHandler(&#8220;TabSelect&#8221;, myHandler, true);<br />
/**/</p>
<p>So your function &#8216;myHandler&#8217; would get fired up every-time the user selects a Tab. You probably want to tie your handler to more events than just the TabSelect event. This may help: <a href="https://developer.mozilla.org/en/Code_snippets/Tabbed_browser" rel="nofollow">https://developer.mozilla.org/en/Code_snippets/Tabbed_browser</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-5</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Wed, 07 Oct 2009 14:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-5</guid>
		<description>First of all, thanks for your quick reply. I didn&#039;t know obj served as some kind of a pointer so to say. I&#039;m not familiar with javascript at all, so bear with me. However, it still doesn&#039;t work with the changes I made now. I hope I haven&#039;t forgotten to change something, rendering my reply pointless.

(function() {
	var obj = document.getElementById(&quot;urlbar&quot;);
	if(obj.value == &quot;file:///D:/Modding/startpage/home.htm&quot;) {
		obj.value = &quot;brap&quot;;
	}
})();

The reason for the removal is a purely aesthetic one. I&#039;m currently heavily modding my entire desktop, from gtk theme to firefox layout. I&#039;m also using a custom start page and it simply looks ugly to me to have the file url shown. That&#039;s why I only need to remove it for a certain string.</description>
		<content:encoded><![CDATA[<p>First of all, thanks for your quick reply. I didn&#8217;t know obj served as some kind of a pointer so to say. I&#8217;m not familiar with javascript at all, so bear with me. However, it still doesn&#8217;t work with the changes I made now. I hope I haven&#8217;t forgotten to change something, rendering my reply pointless.</p>
<p>(function() {<br />
	var obj = document.getElementById(&#8220;urlbar&#8221;);<br />
	if(obj.value == &#8220;file:///D:/Modding/startpage/home.htm&#8221;) {<br />
		obj.value = &#8220;brap&#8221;;<br />
	}<br />
})();</p>
<p>The reason for the removal is a purely aesthetic one. I&#8217;m currently heavily modding my entire desktop, from gtk theme to firefox layout. I&#8217;m also using a custom start page and it simply looks ugly to me to have the file url shown. That&#8217;s why I only need to remove it for a certain string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xk0der</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-4</link>
		<dc:creator>xk0der</dc:creator>
		<pubDate>Wed, 07 Oct 2009 13:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-4</guid>
		<description>@Nik : I don&#039;t know why you would like to do such a thing. But anyways, the mistake lies on the line within the if() block.

documen.getElementById(&quot;urlbar&quot;).setAttribute(&quot;value&quot;, &quot;bar&quot;);

should read.

if(...)
{
obj.value = &quot;My value&quot;; // Since obj already holds reference to urlbar
}

OR

if(...)
{
document.getElementById(&quot;urlbar&quot;).value = &quot;My value&quot;;
}

using setAttribute will change the attribute&#039;s value, but not the &quot;value&quot; property, which is the actual text that is displayed.

As demonstrated in the post, to read and write the text displayed, use the property named &quot;value&quot; not the attribute named &quot;value&quot;.</description>
		<content:encoded><![CDATA[<p>@Nik : I don&#8217;t know why you would like to do such a thing. But anyways, the mistake lies on the line within the if() block.</p>
<p>documen.getElementById(&#8220;urlbar&#8221;).setAttribute(&#8220;value&#8221;, &#8220;bar&#8221;);</p>
<p>should read.</p>
<p>if(&#8230;)<br />
{<br />
obj.value = &#8220;My value&#8221;; // Since obj already holds reference to urlbar<br />
}</p>
<p>OR</p>
<p>if(&#8230;)<br />
{<br />
document.getElementById(&#8220;urlbar&#8221;).value = &#8220;My value&#8221;;<br />
}</p>
<p>using setAttribute will change the attribute&#8217;s value, but not the &#8220;value&#8221; property, which is the actual text that is displayed.</p>
<p>As demonstrated in the post, to read and write the text displayed, use the property named &#8220;value&#8221; not the attribute named &#8220;value&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-3</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Wed, 07 Oct 2009 13:29:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-3</guid>
		<description>And no, it doesn&#039;t say &quot;setAttute&quot; in my actual script. Was just a typo when I posted it here :p</description>
		<content:encoded><![CDATA[<p>And no, it doesn&#8217;t say &#8220;setAttute&#8221; in my actual script. Was just a typo when I posted it here :p</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nik</title>
		<link>http://blog.xkoder.com/2006/11/30/current-url-in-firefox/#comment-2</link>
		<dc:creator>nik</dc:creator>
		<pubDate>Wed, 07 Oct 2009 13:26:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xkoder.com/?p=18#comment-2</guid>
		<description>Hey, I was wondering if you might be able to help me with a little scripting. What I wanna do is to get the current url and compare it with a specified string. If the comparison turns out to be true, I want to remove the url, i.e. replace it with &quot;&quot; so to say. For testing purposes I first want to just replace the url with any tesxt. I guess getting the url itself isn&#039;t much of a problem. I&#039;m now using your method from above for this (I used document.getElementById(&quot;urlbar&quot;).getAttute(&quot;value&quot;) before). With a little help of the DOM Inspector I wrote this script for my userChrome.js which just doesn&#039;t work. You don&#039;t have an idea what I might be doing wrong, do you?

(function() 
{
	var obj = document.getElementById(&quot;urlbar&quot;);
	if(obj.value == &quot;file:///home/nik/.startpage/home.htm&quot;)
	{
		document.getElementById(&quot;urlbar&quot;).setAttute(&quot;value&quot;, &quot;bra&quot;);
	}
})();</description>
		<content:encoded><![CDATA[<p>Hey, I was wondering if you might be able to help me with a little scripting. What I wanna do is to get the current url and compare it with a specified string. If the comparison turns out to be true, I want to remove the url, i.e. replace it with &#8220;&#8221; so to say. For testing purposes I first want to just replace the url with any tesxt. I guess getting the url itself isn&#8217;t much of a problem. I&#8217;m now using your method from above for this (I used document.getElementById(&#8220;urlbar&#8221;).getAttute(&#8220;value&#8221;) before). With a little help of the DOM Inspector I wrote this script for my userChrome.js which just doesn&#8217;t work. You don&#8217;t have an idea what I might be doing wrong, do you?</p>
<p>(function()<br />
{<br />
	var obj = document.getElementById(&#8220;urlbar&#8221;);<br />
	if(obj.value == &#8220;file:///home/nik/.startpage/home.htm&#8221;)<br />
	{<br />
		document.getElementById(&#8220;urlbar&#8221;).setAttute(&#8220;value&#8221;, &#8220;bra&#8221;);<br />
	}<br />
})();</p>
]]></content:encoded>
	</item>
</channel>
</rss>

