<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Narga &#187; code recipes</title>
	<atom:link href="http://www.narga.net/tag/code-recipes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.narga.net</link>
	<description>Narga - Ideas and inspiration in my opinion!</description>
	<lastBuildDate>Wed, 18 Jan 2012 20:20:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<atom:link rel='hub' href='http://www.narga.net/?pushpress=hub'/>
		<item>
		<title>How to Open All External Links in a New Window/Tabs by using jquery</title>
		<link>http://www.narga.net/open-all-external-links-new-window-tabs-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-all-external-links-new-window-tabs-jquery</link>
		<comments>http://www.narga.net/open-all-external-links-new-window-tabs-jquery/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 13:30:58 +0000</pubDate>
		<dc:creator>Narga</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[code recipes]]></category>

		<guid isPermaLink="false">http://www.narga.net/?p=1927</guid>
		<description><![CDATA[If you know anything about attribute selectors, that should look familiar to you. Basically, it is saying, apply the attribute target="_blank" to all links that begin with http. I have written a few lines of jQuery code that will convert all external links (i.e. links that begin with http) to links opening up in a new window by injecting the target="_blank" behind the screens.]]></description>
			<content:encoded><![CDATA[<p>Do you ever know the way to open an external link in a new windows or tabs is one of <a rel="nofollow" href="http://www.useit.com/alertbox/990530.html" >"The Top Ten Web Design Mistakes of 1999"</a>?</p>
<blockquote><p>Opening up new browser windows is like a vacuum cleaner sales person who starts a visit by emptying an ash tray on the customer's carpet. Don't pollute my screen with any more windows, thanks (particularly since current operating systems have miserable window management).<br />
Designers open new browser windows on the theory that it keeps users on their site. But even disregarding the user-hostile message implied in taking over the user's machine, the strategy is self-defeating since it disables the Back button which is the normal way users return to previous sites.</p></blockquote>
<p>I discovered right away is that the <span class="functions">&#060;a&#062;</span> tag does not allow the <span class="functions">target</span> attribute in XHTML Strict (nor does it in HTML Strict).<br />
<div id="attachment_1936" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.narga.net/open-all-external-links-new-window-tabs-jquery/external-links/"  rel="attachment wp-att-1936"><img src="http://www.narga.net/wp-content/uploads/2010/01/External-Links.png" alt="External Links" width="400" height="300" class="size-full wp-image-1936" /></a><p class="wp-caption-text">Open external links</p></div>However, the behavior of <span class="functions">&#060;a target="_blank"'&#062;</span> can be replicated in XHTML Strict with semantic markup and scripting.<br />
<span id="more-1927"></span>If you know anything about attribute selectors, that should look familiar to you. Basically, it is saying, apply the attribute <span class="functions">target="_blank"</span> to all links that begin with http. I have written a few lines of jQuery code that will convert all external links (i.e. links that begin with http) to links opening up in a new window by injecting the <span class="functions">&#060;a target="_blank"'&#062;</span> behind the screens. I'm going to make sure you have <a href="http://www.narga.net/google-ajax-libraries-api-wordpres/" title="use Google AJAX Libraries API to Speed up your Ajax apps" >jQuery active on your site, you can do this easily in WordPress</a>, since it’s bundled with the latest installations.</p>
<pre class="brush: jscript; title: ; notranslate">//	Open external links in new windows using jquery
	$('a[href^=&quot;http://&quot;]').filter(function() {
        return this.hostname &amp;&amp; this.hostname !== location.hostname;
    }).attr('target', '_blank');
</pre>
<p>Really easy, really powerful, problem solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.narga.net/open-all-external-links-new-window-tabs-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

