Good day There is a script By clicking on the field, the script opens a new window with a specific authorization page. When you open this page, the login and password fields are filled in automatically. Bitrix 24 script (onclick) Now there is only window.open (' https: //lk.platon .ru / sign_in? locale = en / '); It is necessary that the login and password fields are filled, it is not necessary to log in to the machine. Can anyone help with this issue?
- What if you save data in cookies and read them when you open the page? learn.javascript.ru/cookie - Telion
- cookies are as old as the world, there is localStorage - Vasily Barbashev
- @ Vasily Barbashev I only found out about him 2 weeks ago, I haven’t tried anything yet, so I don’t recommend the unidentified :) - Telion
- @Levelleor is better than cookies, + a normal API for working. Without self-written functions for cooks - Vasily Barbashev
|
1 answer
You should understand that it is not very safe, auto-complete login and password. To fill them, you need to give the server to the client, and to give it safely, you need to identify the client for sure, so that the data are not hijacked bastards), you can of course come up with something, save it in localStorage or something else like a hash in cookies, but it’s all the same once to introduce them yourself (I'm not a security professional).
By the way, a localStorage example based on this. Animated table filling.
The jsbin example works.
window.onload = function() { var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; if (localStorage.myItem == null) { localStorage.myItem = JSON.stringify(arr); alert('хранилище пока не заполнено'); } var val = JSON.parse(localStorage.myItem); (function addInCell() { var cell = document.getElementsByTagName('input'); for (var i = 0; i < cell.length; i++) { (function(i) { setTimeout(function() { cell[i].value = val[i]; }, 500 * i) })(i); } })(); } <input type="text" name="" id=""> <input type="text" name="" id=""> <input type="text" name="" id=""> <input type="text" name="" id=""> <input type="text" name="" id=""> |