Calling a page via a link with a target attribute
Today over at House of Fusion Claude Schneegans asked:
Suppose I have a page like myPage.cfm. Is it possible in this page to detect if it was called from a link having a TARGET="..." attribute?
I decided to throw something together to determine if this was indeed possible. Turns out it is, and here's how I accomplished it. I first whipped up a plain HTML page with two links on it, like so:
<a href="child.html" target="_blank">Open child.html with target="_blank"</a>
<br /><br />
<a href="child.html">Open child.html as normal window</a>
var opener = (parent.opener) ? parent.opener.location.href : 'an unknown window';