]> gitweb.michael.orlitzky.com - charm-bypass.git/commitdiff
index.html.in: also validate the origin/destination when the page loads
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 3 Nov 2023 17:42:21 +0000 (13:42 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 3 Nov 2023 17:42:21 +0000 (13:42 -0400)
Firefox (at least) retains your origin/destination selections when the
page reloads, so if we don't validate those choices at page load, it's
possible to "skip" validation of an invalid pair by submitting the
form right after a reload.

index.html.in

index 8529b358bf46126e9d4a07438a010184caa94439..ac8b2befd2fa04818f6e47fddf15e2ddaf101693 100644 (file)
         document.getElementsByName("destination").forEach(
          (x) => x.addEventListener("change", validate_origin_destination)
         );
+
+       /* Also do it when the page loads, because firefox likes to
+        * remember your selection even after the page reloads. */
+        window.addEventListener("load", validate_origin_destination);
       }
 
     </script>