Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | document.addEventListener("DOMContentLoaded", () => { const selectElement = document.getElementById( "version-select" ) as HTMLSelectElement | null; if (!selectElement) return; selectElement.addEventListener("change", () => { const url = selectElement.value.trim(); if (!url) return; try { const parsedUrl = new URL(url, window.location.origin); // Allow only URLs starting with "http", "https", or "/" if (/^(https?:\/\/|\/)/.test(parsedUrl.href)) { window.location.href = parsedUrl.href; } else { console.error("Blocked unsafe redirect:", parsedUrl.href); } } catch (error) { console.error("Failed to parse URL:", url, error); } }); }); |