Improve and reformat opener
This commit is contained in:
parent
fc370b9e61
commit
0c745d758b
9
opener/iframe.html
Normal file
9
opener/iframe.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Opener</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="index.php" width="500" height="800"></iframe>
|
||||
</body>
|
||||
</html>
|
@ -18,19 +18,26 @@
|
||||
<script>
|
||||
window.onload = function() {
|
||||
|
||||
if (window.opener) {
|
||||
document.getElementById("opener").innerText = window.opener;
|
||||
document.getElementById("opener").className = "green";
|
||||
} else {
|
||||
document.getElementById("opener").innerText = "Null";
|
||||
}
|
||||
if (window.opener) {
|
||||
document.getElementById("opener").innerText = window.opener.location || window.opener;
|
||||
document.getElementById("opener").className = "green";
|
||||
} else {
|
||||
document.getElementById("opener").innerText = "Null";
|
||||
}
|
||||
|
||||
if (window.name) {
|
||||
document.getElementById("name").innerText = window.name;
|
||||
document.getElementById("name").className = "green";
|
||||
} else {
|
||||
document.getElementById("name").innerText = "Empty String";
|
||||
}
|
||||
if (window.name) {
|
||||
document.getElementById("name").innerText = window.name;
|
||||
document.getElementById("name").className = "green";
|
||||
} else {
|
||||
document.getElementById("name").innerText = "Empty String";
|
||||
}
|
||||
|
||||
if (document.referrer) {
|
||||
document.getElementById("referrer").innerText = document.referrer;
|
||||
document.getElementById("referrer").className = "green";
|
||||
} else {
|
||||
document.getElementById("referrer").innerText = "Empty string";
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -41,6 +48,14 @@
|
||||
<h2>JavaScript</h2>
|
||||
 window.opener: <span id="opener" class="grey">Enable JavaScript</span>
|
||||
<br><br>
|
||||
 document.referrer: <span id="referrer" class="grey">Enable JavaScript</span>
|
||||
<br><br>
|
||||
 window.name: <span id="name" class="grey">Enable JavaScript</span>
|
||||
<h2>Test yourself</h2>
|
||||
 <a href="#" onclick="window.open(location.href)">window.open()</a>
|
||||
<br><br>
|
||||
 <a href="/opener"><a></a>
|
||||
<br><br>
|
||||
 <a href="/opener/iframe.html"><iframe></a>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user