andyMatthews.net

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>

I then wrote a companion page which used JavaScript to try and determine the "parent"


var opener = (parent.opener) ? parent.opener.location.href : 'an unknown window';
$('span').html(myParent);

Finally, I used jQuery to write the result of the test to a span tag on the child page. Admittedly this has limited use, but it's a nice means of determining if a target attribute was used to open the window, which essentially gives you access to the parent page with JavaScript if that page is still open.

View the demo.

Chaussures Nike Pas Cher, Nike Air Force 1 Pas Cher, Nike Air VaporMax Pas Cher, Nike Air VaporMax Flyknit 3 Pas Cher, Nike Air VaporMax Plus Pas Cher, Nike Air VaporMax 360 Pas Cher, Nike Air VaporMax 2020 Pas Cher, Nike Air VaporMax 2021 Pas Cher, Nike Air VaporMax EVO Pas Cher, Nike Air Max Pas Cher, Nike Air Max 90 Pas Cher, Nike Air Max 95 Pas Cher, Nike Air Max 97 Pas Cher, Nike Air Max 2021 Pas Cher, Nike Air Max TN Pas Cher, Nike Air Max Plus Pas Cher, Nike Air Max Plus 3 Pas Cher | Zapatillas Nike Baratas, Nike Air Force 1 Baratas, Nike Air VaporMax Baratas, Nike Air VaporMax Flyknit 3 Baratas, Nike Air VaporMax Plus Baratas, Nike Air VaporMax 360 Baratas, Nike Air VaporMax 2020 Baratas, Nike Air VaporMax 2021 Baratas, Nike Air VaporMax EVO Baratas, Nike Air Max Plus Baratas, Nike Air Max Plus 3 Baratas, Nike Air Max 90 Baratas, Nike Air Max 97 Baratas, Nike Air Max 95 Baratas, Nike Air Max 1 Baratas