<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/javascript/tags/open</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Mon, 08 Sep 2008 08:31:05 GMT</pubDate>
<item>
<title>(JavaScript) XHTML Targetted Hyperlinks - wizard04</title>
<link>http://snipplr.com/view/7857/xhtml-targetted-hyperlinks/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 13 Aug 2008 16:11:36 GMT</pubDate>
<guid>http://snipplr.com/view/7857/xhtml-targetted-hyperlinks/</guid>
</item>
<item>
<title>(JavaScript) Mootools set file types to open in new window - gbot</title>
<link>http://snipplr.com/view/5881/mootools-set-file-types-to-open-in-new-window/</link>
<description><![CDATA[ <p>From: David Walsh.
http://davidwalsh.name/dw-content/open-links.php</p> ]]></description>
<pubDate>Wed, 16 Apr 2008 06:30:23 GMT</pubDate>
<guid>http://snipplr.com/view/5881/mootools-set-file-types-to-open-in-new-window/</guid>
</item>
<item>
<title>(JavaScript) Adobe AIR Open New URL with Sandbox Bridge - 1man</title>
<link>http://snipplr.com/view/4442/adobe-air-open-new-url-with-sandbox-bridge/</link>
<description><![CDATA[ <p>Adobe Air has a few security settings that stops you executing certain AIR methods when inside the sandbox. The code below bridges between the root document and the security sandbox, allowing you to open a URL in AIR in a default browser.</p> ]]></description>
<pubDate>Wed, 02 Jan 2008 10:29:36 GMT</pubDate>
<guid>http://snipplr.com/view/4442/adobe-air-open-new-url-with-sandbox-bridge/</guid>
</item>
<item>
<title>(JavaScript) Open New Window Using REL External Instead of Deprecated Target Attribute - jonhenshaw</title>
<link>http://snipplr.com/view/3047/open-new-window-using-rel-external-instead-of-deprecated-target-attribute/</link>
<description><![CDATA[ <p>Excellent Script for opening new windows from links while adhering to modern HTML/XHTML standards. Simple put rel="nofollow" in the anchor and link to the script within the HEAD.

I prefer to remove the text that states the link opens in an external windows. To do that, simply change this part of the last line from this:
("rel","external"," (external website, opens in a new window)")

to this:
("rel","external","")</p> ]]></description>
<pubDate>Tue, 26 Jun 2007 14:52:15 GMT</pubDate>
<guid>http://snipplr.com/view/3047/open-new-window-using-rel-external-instead-of-deprecated-target-attribute/</guid>
</item>
<item>
<title>(JavaScript) Inline new window javascript (pop-up) - mountainash</title>
<link>http://snipplr.com/view/2591/inline-new-window-javascript-popup/</link>
<description><![CDATA[ <p>This code is very streamlined and a good in-line replacement for XHTML validation (target attribute is depreciated). When you can use the DOM to find the links with external JS (see my rel method). Works well if JavaScript is not supported and still allows for user over-ride (ie. new window or new tab).</p> ]]></description>
<pubDate>Thu, 03 May 2007 03:06:14 GMT</pubDate>
<guid>http://snipplr.com/view/2591/inline-new-window-javascript-popup/</guid>
</item>
<item>
<title>(JavaScript) Standard Compliant Way to Open A New Page Function - 1man</title>
<link>http://snipplr.com/view/2245/standard-compliant-way-to-open-a-new-page-function/</link>
<description><![CDATA[ <p>This function allows you to open a new window, without using any inline Javascript. Simply add rel="external" to the link you wish to open in a new window.</p> ]]></description>
<pubDate>Thu, 08 Mar 2007 03:11:32 GMT</pubDate>
<guid>http://snipplr.com/view/2245/standard-compliant-way-to-open-a-new-page-function/</guid>
</item>
<item>
<title>(JavaScript) Opening New Windows With JavaScript, Version 1.2 - jonhenshaw</title>
<link>http://snipplr.com/view/1402/opening-new-windows-with-javascript-version-12/</link>
<description><![CDATA[ <p>A an excellent script for allowing links to open new windows while keeping the code standards compliant.

If you look at the last line of the script, you will notice that the JSTarget.init() function takes three parameters (all optional). This is what makes this script more flexible than the previous versions.</p> ]]></description>
<pubDate>Thu, 12 Oct 2006 19:48:00 GMT</pubDate>
<guid>http://snipplr.com/view/1402/opening-new-windows-with-javascript-version-12/</guid>
</item>
<item>
<title>(JavaScript) New-Window Links in a Standards-Compliant World - zensir</title>
<link>http://snipplr.com/view/913/newwindow-links-in-a-standardscompliant-world/</link>
<description><![CDATA[ <p>Much to the chagrin of Web designers everywhere, the HTML 4.0 Strict and XHTML 1.0 Strict recommendations of the W3C no longer include the target attribute of the  tag. The Transitional versions of the specifications still include it, but by definition, these specs are on the way out.

Whatever your personal feelings on the practice, the most common application for this attribute -- opening a link in a new browser window with target="_blank" -- is still useful on today's Internet. So if the standards say we shouldn't use it, how should we go about creating new-window links, while following the latest Web standards?
Idealism Applied

The Web standards are written with a lot of ideals in mind. In many cases, established practices go by the wayside in favour of "the right thing to do". One of the ideals that is expressed by the removal of the target attribute from the Strict standards is that (X)HTML should only be concerned with the information that's displayed within a browser window.

Consequently, as soon as we start talking about opening new browser windows, the idealistic notion is that we have exceeded the responsibilities of (X)HTML and entered the world of client-side scripting (i.e. JavaScript).

But before we dive into the JavaScript code necessary to open a link in a new browser window, we still have a fundamental problem to solve. We still need a way to mark links that should be opened in a new window, and if we can't use the target attribute to do it, we need to find some other way -- a way that fits with the ideals behind the latest (X)HTML standards.
A New Relationship

The HTML 4.0 specification took away the target attribute, but it added another attribute: rel. This attribute is intended to specify the relationship between the document that contains the link, and the target of the link. The specification defines a bunch of standard values for this attribute (e.g. next, previous, chapter, section), most of which have to do with relationships between small sections of a larger document. However, the spec leaves the developer free to use nonstandard values for site-specific purposes.
Here at SitePoint, we have adopted a custom value for the rel attribute to mark links leading to other Websites. These are the very same links that we want to open in a new browser window. For these links, we set the rel attribute to external.

Before:

external link

After:

external link

So, now that we have our new-window links marked up in a standards-compliant way, we need to write the JavaScript that will cause them to actually open in a new window.</p> ]]></description>
<pubDate>Wed, 23 Aug 2006 06:10:06 GMT</pubDate>
<guid>http://snipplr.com/view/913/newwindow-links-in-a-standardscompliant-world/</guid>
</item>
<item>
<title>(JavaScript) Javascript Popup with Blocking detection - cochambre</title>
<link>http://snipplr.com/view/365/javascript-popup-with-blocking-detection/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 12 Jul 2006 11:11:15 GMT</pubDate>
<guid>http://snipplr.com/view/365/javascript-popup-with-blocking-detection/</guid>
</item>
</channel>
</rss>