-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* This instantiates a page where a nested iframe strategy is used. | ||
*/ | ||
|
||
const parentWindow = window.parent; // opener of iframe. | ||
const child = (document.getElementById("iframe") as HTMLIFrameElement) | ||
const childWindow = child?.contentWindow!!; | ||
|
||
// implementation of broadcast, desktop-agent side (post-message-protocol version) | ||
window.addEventListener( | ||
"message", | ||
(event) => { | ||
const data = event.data; | ||
if (event.source == parentWindow) { | ||
// from the parent | ||
childWindow.postMessage(event.data, "*"); | ||
} else if (event.source == childWindow) { | ||
parentWindow.postMessage(event.data, "*"); | ||
} | ||
}); | ||
|
||
// next, set up the child | ||
const url = window.location.href; | ||
const childLocation = url.substring(url.lastIndexOf("url=")+4); | ||
child?.setAttribute("src", childLocation); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<html> | ||
<head> | ||
<title>Test Layout</title> | ||
<style type="text/css"> | ||
body, html | ||
{ | ||
margin: 0; padding: 0; height: 100%; overflow: hidden; | ||
} | ||
|
||
#content | ||
{ | ||
position:absolute; left: 0; right: 0; bottom: 0; top: 0px; | ||
} | ||
|
||
#ribbon { | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
width: 100px; | ||
} | ||
</style> | ||
<script type="module" src="/src/demo/nested.ts"></script> | ||
</head> | ||
<body> | ||
<img id="ribbon" src="corner.png" /> | ||
<div id="content"> | ||
<iframe id="iframe" width="100%" height="100%" frameborder="0" src=""></iframe> | ||
</div> | ||
</body> | ||
</html> |