<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Gemal&apos;s Psyched Blog - Comments on Best way to get location from inside a extension</title>
		<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/index.html</link>
		<description>Somehow I cant believe I&apos;m asking this question, since it should be documented and used in almost every extension but there seems to be an almost endless way to get the URL of the current document. So my question is:...</description>
		<language>en-us</language>
		<copyright>Copyright 2009</copyright>
		<lastBuildDate>Wed, 28 Jan 2009 22:48:53 +0100</lastBuildDate>
		<pubDate>Mon, 16 Feb 2009 09:33:12 +0100</pubDate>
		<generator>http://www.movabletype.org/?v=3.17</generator>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<image>
			<link>http://gemal.dk/</link>
			<url>http://gemal.dk//pics/favicon.png</url>
			<title>Gemal&apos;s Psyched Blog</title>
		</image>
		
			<item>
				<title>By Wladimir Palant</title>
				<description>top.location.href, definitely (at least if you are trying to do it from the document loaded - this wasn&apos;t quite clear from you post). If you want documentation - find JavaScript 1.3 Reference (this version still has some info on window and document objects unlike JS 1.5).window.location - the string representation of the Location object matches the href property but you shouldn&apos;t rely on thisdocument.location - this is only for compatibility, I think this was a IE-only feature originallydocument.URL - JS 1.3 Reference explains how this differs from window.location.href. Usually you shouldn&apos;t need this.window.top getBrowser(), content etc - rrrright, why simple if you can do it complicated</description>
				<content:encoded><![CDATA[<p>top.location.href, definitely (at least if you are trying to do it from the document loaded - this wasn't quite clear from you post). If you want documentation - find JavaScript 1.3 Reference (this version still has some info on window and document objects unlike JS 1.5).</p>

<p>window.location - the string representation of the Location object matches the href property but you shouldn't rely on this<br />
document.location - this is only for compatibility, I think this was a IE-only feature originally<br />
document.URL - JS 1.3 Reference explains how this differs from window.location.href. Usually you shouldn't need this.<br />
window.top <br />
getBrowser(), content etc - rrrright, why simple if you can do it complicated</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment1?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment1</guid>
				<pubDate>Tue, 27 Sep 2005 19:51:55 +0100</pubDate>
				<author>
					<name>Wladimir Palant</name>
					<email>trev@gtchat.de</email>
				</author>
			</item>
		
			<item>
				<title>By Wladimir Palant</title>
				<description>Yes, and if you are doing it from some script running outside the document loaded, then you probably need getBrowser().contentWindow.location.href.</description>
				<content:encoded><![CDATA[<p>Yes, and if you are doing it from some script running outside the document loaded, then you probably need getBrowser().contentWindow.location.href.</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment2?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment2</guid>
				<pubDate>Tue, 27 Sep 2005 19:56:53 +0100</pubDate>
				<author>
					<name>Wladimir Palant</name>
					<email>trev@gtchat.de</email>
				</author>
			</item>
		
			<item>
				<title>By Laurence</title>
				<description>&quot;... in both the current Mozilla SeaMonkey and Mozilla Firefox.&quot;I thought that SeaMonkey is no longer a part of Mozilla, as in it is now being developed independently of Mozillian trendy ideas? (Apart from the Mozilla Foundation providing infrastructure resources &quot;only.&quot;)Signed,&apos;Confused&apos;</description>
				<content:encoded><![CDATA[<p>"... in both the current Mozilla SeaMonkey and Mozilla Firefox."</p>

<p>I thought that SeaMonkey is no longer a part of Mozilla, as in it is now being developed independently of Mozillian trendy ideas? (Apart from the Mozilla Foundation providing infrastructure resources "only.")</p>

<p>Signed,<br />
'Confused'<br />
</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment3?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment3</guid>
				<pubDate>Tue, 27 Sep 2005 21:39:32 +0100</pubDate>
				<author>
					<name>Laurence</name>
					<email>lcoakley@yahoo.com</email>
				</author>
			</item>
		
			<item>
				<title>By Jesse Ruderman</title>
				<description>Do you want the exact URL of the page, the URL as displayed in the adddress bar (without wyciwyg), or the URL that sorta corresponds to the document&apos;s principal (without jar, javascript, data, wyciwyg)? This depends on what you&apos;re going to do with the URL.Also, are you sure you want a URL string instead of an nsIURI object?</description>
				<content:encoded><![CDATA[<p>Do you want the exact URL of the page, the URL as displayed in the adddress bar (without wyciwyg), or the URL that sorta corresponds to the document's principal (without jar, javascript, data, wyciwyg)? This depends on what you're going to do with the URL.</p>

<p>Also, are you sure you want a URL string instead of an nsIURI object?</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment4?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment4</guid>
				<pubDate>Tue, 27 Sep 2005 21:41:37 +0100</pubDate>
				<author>
					<name>Jesse Ruderman</name>
					<email>jruderman@gmail.com</email>
				</author>
			</item>
		
			<item>
				<title>By LouCypher</title>
				<description>gBrowser().mCurrentBrowser.currentURI.specshould begBrowser.mCurrentBrowser.currentURI.spec</description>
				<content:encoded><![CDATA[<p>gBrowser().mCurrentBrowser.currentURI.spec</p>

<p>should be</p>

<p>gBrowser.mCurrentBrowser.currentURI.spec</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment5?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment5</guid>
				<pubDate>Tue, 27 Sep 2005 21:50:48 +0100</pubDate>
				<author>
					<name>LouCypher</name>
					<email>gravatar@loucypher.cjb.net</email>
				</author>
			</item>
		
			<item>
				<title>By Jon Henry</title>
				<description>Laurance: You are correct. But how exactly is that relevant to Henrik&apos;s extensions?</description>
				<content:encoded><![CDATA[<p>Laurance: You are correct. But how exactly is that relevant to Henrik's extensions?</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment6?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment6</guid>
				<pubDate>Tue, 27 Sep 2005 22:36:10 +0100</pubDate>
				<author>
					<name>Jon Henry</name>
					<email>jhenry@ccs.neu.edu</email>
				</author>
			</item>
		
			<item>
				<title>By christian biesinger</title>
				<description>guys, what&apos;s wrong with:getBrowser().currentURI.spec?seems easier than either of:&gt;gBrowser.mCurrentBrowser.currentURI.specand&gt;getBrowser().contentWindow.location.href.Also, you should generally prefer URI objects to URI strings...(as for your blog posting, &quot;window&quot; and &quot;document&quot; refer to the chrome window, so they are usually a chrome:// url. if you want the url loaded in the browser, you&apos;d need content.* / content.document.*)</description>
				<content:encoded><![CDATA[<p>guys, what's wrong with:<br />
getBrowser().currentURI.spec?</p>

<p>seems easier than either of:<br />
>gBrowser.mCurrentBrowser.currentURI.spec<br />
and<br />
>getBrowser().contentWindow.location.href.</p>

<p>Also, you should generally prefer URI objects to URI strings...</p>

<p>(as for your blog posting, "window" and "document" refer to the chrome window, so they are usually a chrome:// url. if you want the url loaded in the browser, you'd need content.* / content.document.*)</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment7?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment7</guid>
				<pubDate>Wed, 28 Sep 2005 03:41:21 +0100</pubDate>
				<author>
					<name>christian biesinger</name>
					<email>cbiesinger@web.de</email>
				</author>
			</item>
		
			<item>
				<title>By Jeff Walden</title>
				<description>Generally, properties that start with &quot;m&quot; followed by a camelcased word or phrase are intended to be private variables, so you&apos;re setting yourself up to be broken at some point if you use |getBrowser().mCurrentBrowser| and friends; there are public interfaces which do the trick just as well and are less likely to be broken.Another point to mention is that (to the best of my knowledge) a tabbrowser is supposed to have attributes and properties which are a superset of those of a browser, meaning that if you use browser properties on a tabbrowser you&apos;ll get the same results for the currently viewed URL in a browser.  This is so that you don&apos;t need to know anything about tabbrowsers if your code doesn&apos;t explicitly interact with them.</description>
				<content:encoded><![CDATA[<p>Generally, properties that start with "m" followed by a camelcased word or phrase are intended to be private variables, so you're setting yourself up to be broken at some point if you use |getBrowser().mCurrentBrowser| and friends; there are public interfaces which do the trick just as well and are less likely to be broken.</p>

<p>Another point to mention is that (to the best of my knowledge) a tabbrowser is supposed to have attributes and properties which are a superset of those of a browser, meaning that if you use browser properties on a tabbrowser you'll get the same results for the currently viewed URL in a browser.  This is so that you don't need to know anything about tabbrowsers if your code doesn't explicitly interact with them.</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment8?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment8</guid>
				<pubDate>Wed, 28 Sep 2005 05:28:40 +0100</pubDate>
				<author>
					<name>Jeff Walden</name>
					<email>jwalden@mit.edu</email>
				</author>
			</item>
		
			<item>
				<title>By jed</title>
				<description>I think what you should *officially* use is window.content.location.hrefThis is what Firefox uses it&apos;s it&apos;s browser code for sending a URL via e-mail. This also assumes you want what is found in the location bar.(see: http://lxr.mozilla.org/mozilla1.8/source/browser/base/content/browser.js#5603 )I used to use:Components.lookupMethod(window._content, &apos;location&apos;).call(window._content).hrefAs it&apos;s was the &apos;safe way&apos; to do it as I think it was an older form of XPWrappers.</description>
				<content:encoded><![CDATA[<p>I think what you should *officially* use is </p>

<p>window.content.location.href</p>

<p>This is what Firefox uses it's it's browser code for sending a URL via e-mail. This also assumes you want what is found in the location bar.</p>

<p><br />
(see: <a href="http://lxr.mozilla.org/mozilla1.8/source/browser/base/content/browser.js#5603" rel="nofollow">http://lxr.mozilla.org/mozilla1.8/source/browser/base/content/browser.js#5603</a> )</p>

<p>I used to use:<br />
Components.lookupMethod(window._content, 'location').call(window._content).href</p>

<p>As it's was the 'safe way' to do it as I think it was an older form of XPWrappers.</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment9?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment9</guid>
				<pubDate>Wed, 28 Sep 2005 05:34:44 +0100</pubDate>
				<author>
					<name>jed</name>
					<email>seeurl@seeurlbelow.com</email>
				</author>
			</item>
		
			<item>
				<title>By Bob</title>
				<description>Well, hello everyone.It looks like this page talks about what I&apos;m looking for! Maybe you guys can give me a big help.I&apos;ve place an extension in my Internet Explorer tool bar, which has to replace the current URL, depending on the situation...for example: if the user is in URL1, then by clicking the button, the browser should redirect to URL2. If the user is in URL2, then he should go to URL1. So, when the user click the button, it will call a .js file, which will find out where the user is, then change the URL. The problem is, when the .js file is called, it can&apos;t get the current URL. I&apos;ve made a test, with alert(window.location.href), but it shows the physical path of the file in my PC (like file:///C:/...) So, all I want now is to be able to find out where the user is, from an Internet Explorer extension. I&apos;ve tried everything, like window.referrer, window.location, this.window.location, but nothing. Any ideas?Thanks everyone.</description>
				<content:encoded><![CDATA[<p>Well, hello everyone.<br />
It looks like this page talks about what I'm looking for! Maybe you guys can give me a big help.<br />
I've place an extension in my Internet Explorer tool bar, which has to replace the current URL, depending on the situation...<br />
for example: if the user is in URL1, then by clicking the button, the browser should redirect to URL2. If the user is in URL2, then he should go to URL1. So, when the user click the button, it will call a .js file, which will find out where the user is, then change the URL. The problem is, when the .js file is called, it can't get the current URL. I've made a test, with alert(window.location.href), but it shows the physical path of the file in my PC (like file:///C:/...) So, all I want now is to be able to find out where the user is, from an Internet Explorer extension. I've tried everything, like window.referrer, window.location, this.window.location, but nothing. Any ideas?</p>

<p>Thanks everyone.</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment10?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment10</guid>
				<pubDate>Tue, 25 Oct 2005 19:48:28 +0100</pubDate>
				<author>
					<name>Bob</name>
					<email>robertogeller@ig.com.br</email>
				</author>
			</item>
		
			<item>
				<title>By jitendra</title>
				<description>how to use this in firefox</description>
				<content:encoded><![CDATA[<p>how to use this in firefox</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment11?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment11</guid>
				<pubDate>Fri, 31 Mar 2006 12:44:03 +0100</pubDate>
				<author>
					<name>jitendra</name>
					<email>jitendrac4u_jain@rediffmail.cm</email>
				</author>
			</item>
		
			<item>
				<title>By cheeseboy</title>
				<description>Um, Bob, maybe this is noobish but how exactly do you make an Internet Explorer extension?</description>
				<content:encoded><![CDATA[<p>Um, Bob, maybe this is noobish but how exactly do you make an Internet Explorer extension?</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment12?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment12</guid>
				<pubDate>Mon, 31 Jul 2006 09:06:27 +0100</pubDate>
				<author>
					<name>cheeseboy</name>
					<email>irishmidgets@gmail.com</email>
				</author>
			</item>
		
			<item>
				<title>By ed raket</title>
				<description>IE calls it a Browser Helper Object (all native), which is more complex (C++) than an extension written in a high level language.</description>
				<content:encoded><![CDATA[<p>IE calls it a Browser Helper Object (all native), which is more complex (C++) than an extension written in a high level language.</p>]]></content:encoded>
				<link>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment13?from=rss-comment</link>
				<guid>http://gemal.dk/blog/2005/09/27/best_way_to_get_location_from_inside_a_extension/#comment13</guid>
				<pubDate>Fri, 15 Sep 2006 14:50:17 +0100</pubDate>
				<author>
					<name>ed raket</name>
					<email>teh.ed.x@gmail.com</email>
				</author>
			</item>
		
	</channel>
</rss>

