<?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>Kurinchi Blogger Scribbles ... &#187; http links new window</title>
	<atom:link href="http://kurinchilamp.kurinchilion.com/tag/http-links-new-window/feed" rel="self" type="application/rss+xml" />
	<link>http://kurinchilamp.kurinchilion.com</link>
	<description>On Open Source Technologies</description>
	<lastBuildDate>Mon, 02 Jan 2012 06:14:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How to open ALL external web sites or references in a NEW window?</title>
		<link>http://kurinchilamp.kurinchilion.com/2009/09/how-to-open-all-external-web-sites-or-references-in-a-new-window.html</link>
		<comments>http://kurinchilamp.kurinchilion.com/2009/09/how-to-open-all-external-web-sites-or-references-in-a-new-window.html#comments</comments>
		<pubDate>Sun, 06 Sep 2009 01:58:13 +0000</pubDate>
		<dc:creator>kurinchilamp</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[UI, CSS]]></category>
		<category><![CDATA[external links new window]]></category>
		<category><![CDATA[http links new window]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[new window open]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://kurinchilamp.kurinchilion.com/?p=670</guid>
		<description><![CDATA[Using JQuery to open external links in new windows Earlier we used to write a string of code in javascript to enable opening external references in a new window in addition to modifying the html code With JQuery, this can be done with one line of code as shown below $(document).ready(function(){ $("a[@href^='http']").attr('target','_blank'); }); The above [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Using JQuery to open external links in new windows</strong></p>
<p>Earlier we used to write a string of code in javascript to enable opening external references in a new window in addition to modifying the html code </p>
<p>With JQuery, this can be done with one line of code as shown below</p>
<pre class="brush: php;">
$(document).ready(function(){
    $("a[@href^='http']").attr('target','_blank');
});
</pre>
<p>The above line checks for occurences http in a tag and if a link has &#8220;http&#8221; in it, JQuery opens the link in a NEW window.</p>
<p>According to W3C standards, the target attribute has been removed from <a href="http://www.w3.org/MarkUp/2004/xhtml-faq#target" target="_blank">xhtml 1.1 specification</a>. </p>
<p><strong>Sample script to open external links in New Window</strong></p>
<pre class="brush: php;">
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB"&gt;
&lt;head&gt;
&lt;script src="js/jquery-1.3.2.min.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="javascript"&gt;
$(document).ready(function(){
    $("a[href^='http']").attr('target','_blank');
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

Testing the pages - Open Links in new &lt;a href="http://yahoo.com"&gt;window&lt;/a&gt;.

&lt;h1>&lt;a href="http://www.kurinchilion.com"&gt;Kurinchilion&lt;/a&gt;&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kurinchilamp.kurinchilion.com/2009/09/how-to-open-all-external-web-sites-or-references-in-a-new-window.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

