Spaces:
Running
Running
File size: 1,410 Bytes
1b2afe2 644c4fc 1b2afe2 644c4fc 1b2afe2 |
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 32 33 34 35 36 37 38 39 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>My static Space</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="card">
<h1>Space tester</h1>
<form>
<fieldset name="urlparams">
<legend>URL params</legend>
<div>
<label>Query params <input name="queryparams" type="text" placeholder="?key=value"></label>
</div>
<div>
<label>Hash <input name="hash" type="text" placeholder="#hash"></label>
</div>
<div>
<button type="button">Update embedder URL</button>
</div>
</fieldset>
</form>
</div>
<script async>
const urlparams = document.querySelector('[name="urlparams"]');
urlparams.querySelector('button').addEventListener('click', () => {
const queryString = urlparams.querySelector('[name="queryparams"]').value;
const hash = urlparams.querySelector('[name="hash"]').value;
if(hash || queryString) {
window.parent.postMessage(JSON.stringify( {hash, queryString }));
}
});
</script>
</body>
</html>
|