File: dynamic-oopif.html

package info (click to toggle)
node-playwright 1.38.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,720 kB
  • sloc: javascript: 114,018; sh: 899; java: 372; xml: 247; cs: 118; python: 29; makefile: 13
file content (31 lines) | stat: -rw-r--r-- 723 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<style>
  body, html {
    margin: 0;
  }
  iframe {
    width: 300px;
    height: 300px;
    margin: 0;
    padding: 0;
    border: 0;
  }
</style>
<script>
function goLocal() {
  document.querySelector('iframe').src = location.href.replace('dynamic-oopif.html', 'grid.html');
}

function goRemote(iframe) {
  iframe = iframe || document.querySelector('iframe');
  const url = new URL(location.href);
  url.hostname = url.hostname === 'localhost' ? '127.0.0.1' : 'localhost';
  url.pathname = '/grid.html';
  iframe.src = url.toString();
}

window.addEventListener('DOMContentLoaded', () => {
  const iframe = document.createElement('iframe');
  goRemote(iframe);
  document.body.appendChild(iframe);
}, false);
</script>