Skip to content

Instantly share code, notes, and snippets.

@ZeroOne3010
Created December 22, 2017 23:34
Show Gist options
  • Select an option

  • Save ZeroOne3010/e78af7204afe09a327cd913221907396 to your computer and use it in GitHub Desktop.

Select an option

Save ZeroOne3010/e78af7204afe09a327cd913221907396 to your computer and use it in GitHub Desktop.
A page that displays three other web pages in iframes, side by side, based on the query parameters.
<html>
<head>
<style type="text/css">
body {
margin: 0;
}
iframe {
padding: 0;
margin: 0;
border: none;
margin: 0;
padding: 0;
display: block;
height: 99vh;
float: left;
}
#iframe1 {
margin-left: 2vw;
width: 33vw;
}
#iframe2 {
width: 30vw;
}
#iframe3 {
width: 33vw;
}
</style>
<title>Info</title>
<script type="text/javascript">
function getQueryVariable(variable) {
/* https://css-tricks.com/snippets/javascript/get-url-variables/ */
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) { return pair[1]; }
}
return (false);
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById("iframe1").src = getQueryVariable("frame1");
document.getElementById("iframe2").src = getQueryVariable("frame2");
document.getElementById("iframe3").src = getQueryVariable("frame3");
}, false);
</script>
</head>
<body>
<iframe src="#" id="iframe1"></iframe>
<iframe src="#" id="iframe2"></iframe>
<iframe src="#" id="iframe3"></iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment