Sorry about that Paul , I’ll Post 2 of the 5 , very small pages here .
Which-Open-Links-In-iFrame-Which.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Opening Links in an iFrame</title>
<style>
iframe {
width: 100%;
height: 500px;
}
</style>
</head>
<body>
<p style="text-align: center;">Communiation Between 'parent' and 'iframe Child' elements
<br>On <a> Click in 'iframe' , Send Clicked Url to a 'parent' function .</p>
<iframe src="SomeLocalLinks-01.html" name="myFrame"></iframe>
<script>
var links = myFrame.document.querySelectorAll( 'a' );
for ( var c = 0; c < links.length; c ++ ) {
links[c].addEventListener('click', WhichLinkWasClicked);
}
function WhichLinkWasClicked(evt) {
alert( evt.target ) ;
evt.preventDefault();
}
</script></body></html>
SomeLocalLinks-01.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Opening Links from an iFrame</title>
<style>
iframe {
width: 100%;
height: 500px;
}
</style>
</head>
<body>
<p style="text-align: center">Same-Domain , Same Folder</p>
<br><br><a href="SomeLocalLinks-01.html">SomeLocalLinks-01</a>
<br><br><a href="SomeLocalLinks-02.html">SomeLocalLinks-02</a>
<br><br><a href="SomeLocalLinks-03.html">SomeLocalLinks-03</a>
<br><br><a href="SomeLocalLinks-04.html">SomeLocalLinks-04</a>
<br><br></body></html>
Pages 02,03,04, are exactly the same as page01 , except that the order of the links is different .
All the files are there as ‘fodder for testing’ .
My goal is to figure out how to inject/run code inside of an iframe page . I have an application that desperately needs parent/child communication abilities .
Thanks for your Help…