5 function handleSubmitFormEvent(e
) {
7 var xhr
= new XMLHttpRequest();
8 xhr
.onreadystatechange = function() {
9 history
.pushState({}, "", "password_push_state.html"); };
10 xhr
.open("GET", "password_push_state.html", true);
14 window
.onload = function() {
15 document
.getElementById("testform")
16 .addEventListener("submit", handleSubmitFormEvent
);
17 document
.getElementById("chg_testform")
18 .addEventListener("submit", handleSubmitFormEvent
);
19 document
.getElementById("mark_chg_testform")
20 .addEventListener("submit", handleSubmitFormEvent
);
26 <form action=
"password_push_state.html"
28 <input type=
"text" id=
"username_field" name=
"username_field">
29 <input type=
"password" id=
"password_field" name=
"password_field">
30 <input type=
"submit" id=
"submit_button" name=
"submit_button">
33 <!-- Change password form without the username explicitly marked. -->
34 <form action=
"password_push_state.html" id=
"chg_testform">
35 <!-- No autocomplete=username. -->
36 <input type=
"text" id=
"chg_not_username_field" name=
"chg_not_username_field">
37 <input type=
"password" id=
"chg_password_field" name=
"chg_password_field"
38 autocomplete=
"current-password">
39 <input type=
"password" id=
"chg_new_password_1" name=
"chg_new_password_1"
40 autocomplete=
"new-password">
41 <input type=
"password" id=
"chg_new_password_2" name=
"chg_new_password_2"
42 autocomplete=
"new-password">
43 <input type=
"submit" id=
"chg_submit_button" name=
"chg_submit_button">
46 <!-- Change password form with the username explicitly marked. -->
47 <form action=
"password_push_state.html" id=
"mark_chg_testform">
48 <input type=
"text" id=
"mark_chg_username_field" name=
"mark_chg_username_field"
49 autocomplete=
"username">
50 <input type=
"password" id=
"mark_chg_password_field"
51 name=
"mark_chg_password_field" autocomplete=
"current-password">
52 <input type=
"password" id=
"mark_chg_new_password_1"
53 name=
"mark_chg_new_password_1" autocomplete=
"new-password">
54 <input type=
"password" id=
"mark_chg_new_password_2"
55 name=
"mark_chg_new_password_2" autocomplete=
"new-password">
56 <input type=
"submit" id=
"mark_chg_submit_button"
57 name=
"mark_chg_submit_button">