回答編集履歴
1
実装例追加
answer
CHANGED
@@ -2,4 +2,16 @@
|
|
2
2
|
ただ、これだとサーバー側の変更も必要になってくるでしょう。
|
3
3
|
jQuery disableAutoFill プラグインのような考えで、入力時は別名にしておき、送信前に本来のnameに変更するようにすれば、サーバーを変えずに対応できます。
|
4
4
|
|
5
|
-
[https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin](https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin)
|
5
|
+
[https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin](https://developer.mozilla.org/ja/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields#Use_jQuery_disableAutoFill_Plugin)
|
6
|
+
|
7
|
+
-- 実装例追加
|
8
|
+
|
9
|
+
```JavaScript
|
10
|
+
document.addEventListener('DOMContentLoaded', event => {
|
11
|
+
const sx = '-' + btoa(location.pathname);
|
12
|
+
document.querySelectorAll('input[name]').forEach(v => { v.dataset['name'] = v.name; v.name += sx; });
|
13
|
+
document.addEventListener('submit', event => {
|
14
|
+
document.querySelectorAll('input[name][data-name]').forEach(v => v.name = v.dataset['name']);
|
15
|
+
});
|
16
|
+
});
|
17
|
+
```
|