Skip to content

Commit 4cf7bf7

Browse files
authored
Add URL parameter handling on page load
Added a function to handle URL parameters on page load, setting the input field value and triggering the lookup if a domain parameter is present.
1 parent 359c509 commit 4cf7bf7

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,23 @@ <h2>📌 CAA records for</h2>
784784
checkBtn.addEventListener('click', performLookup);
785785
domainInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') performLookup(); });
786786

787+
// ===== NEW CODE: Handle URL parameter on page load =====
788+
function handleUrlParameter() {
789+
const urlParams = new URLSearchParams(window.location.search);
790+
const domainParam = urlParams.get('domain');
791+
792+
if (domainParam) {
793+
// Set the input field value
794+
domainInput.value = domainParam;
795+
// Automatically trigger the CAA lookup
796+
performLookup();
797+
}
798+
}
799+
800+
// Call the function when the page loads
801+
window.addEventListener('load', handleUrlParameter);
802+
// ===== END OF NEW CODE =====
803+
787804
// initial placeholder
788805
renderGeneratedList(); // empty list
789806
})();

0 commit comments

Comments
 (0)