File size: 744 Bytes
76e276e dde26cd 76e276e dde26cd b9c5a8f dde26cd 76e276e |
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 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Static Space URL sync example</title>
</head>
<body>
<label for="">
Query string
<input type="text" id="query">
</label>
<label>
Hash
<input type="text" id="hash">
</label>
<button onclick="sync()">Sync</button>
<script>
function sync() {
const queryString = document.getElementById("query").value;
const hash = document.getElementById("hash").value;
// HF Spaces' spacial message type to update the query string and the hash in the parent page URL
window.parent.postMessage({
queryString,
hash,
}, "https://huggingface.co");
}
</script>
</body>
</html>
|