Unique web browser identification ID for web control panel logins in Perl

后端 未结 4 1587
北荒
北荒 2020-12-16 13:59

Do web browsers have a unique ID that can be passed on to Perl scripts? (Like a unique serial - like products that you buy in the shop have for example)

For instanc

4条回答
  •  醉酒成梦
    2020-12-16 14:16

    You can store some unique values (e.g.: user id) in the user browser using "Html Local Storage" permanently with no expiration date, and store the same values with info about the user agent in the db.

    Then you pass the user agent info with the data in the local storage and match it with the ones in the database...

    // store
    localStorage.setItem("myValue", "123-abcd");
    
    // retrieve
    var myValue = localStorage.getItem("myValue");
    

    I'm not sure how much secure is this approach to identify users, but the Html Local Storage supposed to be accessible for only pages from one origin (same domain and protocol).

    There is also "HTML Session Storage" to store data in the users browser for only one session.

提交回复
热议问题