I have 2 pages with the names first.html and second.html, as well as the fi.js and se.js scripts for them. I need to transfer the data entered by the user on the page first.html, to the page second.html, preferably without switching the user to second.html. But when Russian characters are entered into the form, they are read in the wrong encoding on the second page. How to fix it?
first.html
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Fill</title> </head> <body> <div class="container"> <form> <table> <tr> <td>От кого</td> <td> <input name="from" type="text" id="fromWHO" placeholder="Ваше имя"> </td> </tr> <tr> <td>Ваш телефон</td> <td> <input name="telephon" id="telephonWHO" type="text" placeholder="Ваш телефон"> </td> </tr> <input type ="button" value="Отправить сообщение" onclick="goMail();" /> </form> </div> </div> </div> <script src="fi.js"></script> </body> </html> second.html
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="se.js"></script> </head> <body onload="OnLoad()"> <font id="UsName"> </font><br> <font id="telephonWHO"> </font> </body> </html> fi.js
function goMail() { if (confirm("Уверены...")) { var UsName = document.getElementById('fromWHO').value; var Tel = document.getElementById('telephonWHO').value; document.location = "second.html?id=" + UsName + '&telephonWHO=' + Tel; } } se.js
function OnLoad() { var query = window.location.href.split("?")[1]; var params = query.split("&"); document.getElementById("UsName").innerHTML = params[0].split("=")[1]; document.getElementById("telephonWHO").innerHTML = params[1].split("=")[1].split("#")[0]; }