<?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: Use jQuery to Open All External Links in a New Window</title>
	<atom:link href="http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/feed/" rel="self" type="application/rss+xml" />
	<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/</link>
	<description>Doing That Web Standards Thing</description>
	<lastBuildDate>Thu, 11 Mar 2010 01:37:28 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: &#187; Automatizzare il &#8220;target _blank&#8221;</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-4398</link>
		<dc:creator>&#187; Automatizzare il &#8220;target _blank&#8221;</dc:creator>
		<pubDate>Sat, 02 Jan 2010 14:28:44 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-4398</guid>
		<description>[...] fonte , demo Se l&#039;articolo era interessante, forse troverai approfondimenti nei seguenti link [...]</description>
		<content:encoded><![CDATA[<p>[...] fonte , demo Se l&#39;articolo era interessante, forse troverai approfondimenti nei seguenti link [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Badger</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-4308</link>
		<dc:creator>Badger</dc:creator>
		<pubDate>Tue, 15 Dec 2009 10:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-4308</guid>
		<description>Thanks Trevor for the snippet and everyone else for input. Great little piece of code.</description>
		<content:encoded><![CDATA[<p>Thanks Trevor for the snippet and everyone else for input. Great little piece of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vladimir Graschenko</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2917</link>
		<dc:creator>Vladimir Graschenko</dc:creator>
		<pubDate>Tue, 05 May 2009 00:42:47 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2917</guid>
		<description>The following code works if you need apply the &quot;new window&quot; rule for all dynamically added links. Useful for UI Tabs or Ajax load. 
&lt;pre&gt;&lt;code&gt;$(&quot;a[href^=&#039;http:&#039;]:not([href*=&#039;&quot; + window.location.host + &quot;&#039;][target=&#039;_blank&#039;])&quot;).live(&#039;click&#039;, function(){
		$(this).attr(&#039;target&#039;,&#039;_blank&#039;);	
	});	
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>The following code works if you need apply the &#8220;new window&#8221; rule for all dynamically added links. Useful for UI Tabs or Ajax load. </p>
<pre><code>$("a[href^='http:']:not([href*='" + window.location.host + "'][target='_blank'])").live('click', function(){
		$(this).attr('target','_blank');
	});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2314</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Tue, 10 Feb 2009 14:32:53 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2314</guid>
		<description>@David-
I would not recommend using embedded JavaScript in production. I would definitely move it to an external script.</description>
		<content:encoded><![CDATA[<p>@David-<br />
I would not recommend using embedded JavaScript in production. I would definitely move it to an external script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2313</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 10 Feb 2009 14:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2313</guid>
		<description>A heads up for everyone else: I run most of my HTML through HTML Tidy (via http://www.topstyle4.com/) to check for errors and format it.  Part of that forces CDATA around embedded JavaScript to make it validate with XHTML.  E.g.

That stopped the code working for me.</description>
		<content:encoded><![CDATA[<p>A heads up for everyone else: I run most of my HTML through HTML Tidy (via <a href="http://www.topstyle4.com/)" rel="nofollow">http://www.topstyle4.com/)</a> to check for errors and format it.  Part of that forces CDATA around embedded JavaScript to make it validate with XHTML.  E.g.</p>
<p>That stopped the code working for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2306</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 10 Feb 2009 02:06:37 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2306</guid>
		<description>Brilliant.  I guess it&#039;s easy when you know how? :)

Thanks very much, Trevor.  Much appreciated.</description>
		<content:encoded><![CDATA[<p>Brilliant.  I guess it&#8217;s easy when you know how? :)</p>
<p>Thanks very much, Trevor.  Much appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2305</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Tue, 10 Feb 2009 01:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2305</guid>
		<description>@David-
Try removing the &lt;strong&gt;@&lt;/strong&gt; from the selector.

&lt;a href=&quot;http://trevordavis.net/play/jquery-open-external-links-in-new-window/links-in-new-window-jquery-13/&quot; class=&quot;more-link&quot; rel=&quot;nofollow&quot;&gt;See a Demo&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>@David-<br />
Try removing the <strong>@</strong> from the selector.</p>
<p><a href="http://trevordavis.net/play/jquery-open-external-links-in-new-window/links-in-new-window-jquery-13/" class="more-link" rel="nofollow">See a Demo</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2304</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 10 Feb 2009 01:24:59 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-2304</guid>
		<description>Hi,

I just spent a while trying to work out why this did not work for me - looks like it&#039;s incompatible with jQuery 1.3.1 but works OK with your 1.2.6 code.

Any ideas on what the problem is?  How to fix?

Thanks.

David.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I just spent a while trying to work out why this did not work for me &#8211; looks like it&#8217;s incompatible with jQuery 1.3.1 but works OK with your 1.2.6 code.</p>
<p>Any ideas on what the problem is?  How to fix?</p>
<p>Thanks.</p>
<p>David.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1700</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Fri, 26 Sep 2008 18:29:54 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1700</guid>
		<description>@Roger-
Thanks, that makes sense if you have internal URLs that are absolute. One thing I might change is to have the attribute selector select links that start with &lt;strong&gt;http&lt;/strong&gt; and not &lt;strong&gt;http:&lt;/strong&gt;.

Want to make sure to account for &lt;strong&gt;https&lt;/strong&gt; links.</description>
		<content:encoded><![CDATA[<p>@Roger-<br />
Thanks, that makes sense if you have internal URLs that are absolute. One thing I might change is to have the attribute selector select links that start with <strong>http</strong> and not <strong>http:</strong>.</p>
<p>Want to make sure to account for <strong>https</strong> links.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1693</link>
		<dc:creator>Roger</dc:creator>
		<pubDate>Fri, 26 Sep 2008 01:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1693</guid>
		<description>Thanks. This is simpler (and more up to date, the @ symbol is no longer required)

&lt;pre&gt;&lt;code&gt;jQuery(&quot;a[href^=&#039;http:&#039;]&quot;).not(&quot;[href*=&#039;mydomain.com&#039;]&quot;).attr(&#039;target&#039;,&#039;_blank&#039;);&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Thanks. This is simpler (and more up to date, the @ symbol is no longer required)</p>
<pre><code>jQuery("a[href^='http:']").not("[href*='mydomain.com']").attr('target','_blank');</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1003</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 15 Jul 2008 21:31:24 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1003</guid>
		<description>Whoops, slight error there - in the &quot;not&quot; filter, need to remove the a tags:

&lt;pre&gt;&lt;code&gt;function initExternalLinks() {
	var h = window.location.host.toLowerCase();
	$(&quot;a[@href^=&#039;http&#039;]:not([@href^=&#039;http://&quot; + h + &quot;&#039;]):not([@href^=&#039;http://www.&quot; + h + &quot;&#039;]), a[@href$=&#039;.pdf&#039;]&quot;).css({outline: &#039;solid 1px red&#039;}).attr(&quot;target&quot;, &quot;_blank&quot;);
}&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Whoops, slight error there &#8211; in the &#8220;not&#8221; filter, need to remove the a tags:</p>
<pre><code>function initExternalLinks() {
	var h = window.location.host.toLowerCase();
	$("a[@href^='http']:not([@href^='http://" + h + "']):not([@href^='http://www." + h + "']), a[@href$='.pdf']").css({outline: 'solid 1px red'}).attr("target", "_blank");
}</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1002</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Tue, 15 Jul 2008 21:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-1002</guid>
		<description>Thats good, I&#039;m doing the same thing my self, but have extended it to not process links to the same domain, and pdfs:


&lt;pre&gt;&lt;code&gt;function initExternalLinks() {
	var h = window.location.host.toLowerCase();
	$(&quot;a[@href^=&#039;http&#039;]:not(a[@href^=&#039;http://&quot; + h + &quot;&#039;]):not(a[@href^=&#039;http://www.&quot; + h + &quot;&#039;]), a[@href$=&#039;.pdf&#039;]&quot;).attr(&quot;target&quot;, &quot;_blank&quot;);
}&lt;/code&gt;&lt;/pre&gt;


May be a more elegant way of doing it, but it works</description>
		<content:encoded><![CDATA[<p>Thats good, I&#8217;m doing the same thing my self, but have extended it to not process links to the same domain, and pdfs:</p>
<pre><code>function initExternalLinks() {
	var h = window.location.host.toLowerCase();
	$("a[@href^='http']:not(a[@href^='http://" + h + "']):not(a[@href^='http://www." + h + "']), a[@href$='.pdf']").attr("target", "_blank");
}</code></pre>
<p>May be a more elegant way of doing it, but it works</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jQuery - external links in new window: &#8230; &#171; Random Trap</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-776</link>
		<dc:creator>jQuery - external links in new window: &#8230; &#171; Random Trap</dc:creator>
		<pubDate>Thu, 08 May 2008 19:44:03 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-776</guid>
		<description>[...] pm on May 8, 2008 &#124; # &#124;   Tags: jquery   jQuery - external links in new window: http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/ [...]</description>
		<content:encoded><![CDATA[<p>[...] pm on May 8, 2008 | # |   Tags: jquery   jQuery &#8211; external links in new window: <a href="http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/" rel="nofollow">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: qO_op</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-760</link>
		<dc:creator>qO_op</dc:creator>
		<pubDate>Tue, 06 May 2008 17:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-760</guid>
		<description>i love you and jQuery ;) Thanx!</description>
		<content:encoded><![CDATA[<p>i love you and jQuery ;) Thanx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abrir links externos em nova janela com jQuery &#187; Pinceladas da Web - Reflex&#245;es sobre XHTML, CSS, PHP e WebStandards</title>
		<link>http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-739</link>
		<dc:creator>Abrir links externos em nova janela com jQuery &#187; Pinceladas da Web - Reflex&#245;es sobre XHTML, CSS, PHP e WebStandards</dc:creator>
		<pubDate>Fri, 02 May 2008 09:00:48 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/blog/tutorial/use-jquery-to-open-all-external-links-in-a-new-window/#comment-739</guid>
		<description>[...] Trevor Davis postou em seu site uma solu&#231;&#227;o para abrir links externos em uma nova janela com jQuery, que [...]</description>
		<content:encoded><![CDATA[<p>[...] Trevor Davis postou em seu site uma solu&ccedil;&atilde;o para abrir links externos em uma nova janela com jQuery, que [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
