Update comment
Browse files36 unmodified lines373839404142435 unmodified lines4950515253545556575859606136 unmodified lines</div><script>// Sync query and hash from this embedded app to the parent page URLfunction sync() {const queryString = document.getElementById("query").value;const hash = document.getElementById("hash").value;5 unmodified lines}, "https://huggingface.co");}// Read the initial query and hashconst initialQuery = window.location.search;const initialHash = window.location.hash;document.getElementById("initial-query").value = initialQuery ?? "";document.getElementById("initial-hash").value = initialHash ?? "";// Read the updated hash reactivelywindow.addEventListener("hashchange", (event) => {console.log("hash change event", event);const currentHash = window.location.hash;36 unmodified lines373839404142435 unmodified lines495051525354555657585960616236 unmodified lines</div><script>// Sync query and hash from this embedded app to the parent page URL.function sync() {const queryString = document.getElementById("query").value;const hash = document.getElementById("hash").value;5 unmodified lines}, "https://huggingface.co");}// Read the initial query and hash.const initialQuery = window.location.search;const initialHash = window.location.hash;document.getElementById("initial-query").value = initialQuery ?? "";document.getElementById("initial-hash").value = initialHash ?? "";// Read the updated hash reactively.// Note: there is no way to capture the query string update like this because updating query string causes page-reload (ref: https://stackoverflow.com/a/4291024).window.addEventListener("hashchange", (event) => {console.log("hash change event", event);const currentHash = window.location.hash;
index.html+4-3