0
Is there any other way rather than localStorage, cookies or without session(login) to uniquely identity shopping cart item?
I want to make shopping cart and wanna uniquely identity shop cart item of different browser use by user without any use of localStorage, cookies or without any further session or login? One idea get into my to pick ip address and make it primary key to filter but this is not good practice, ip address may be changed after switching isp, So rather than this all is there any other way?
13 ответов
+ 6
Prince Raj Another problem with attempting to map a user to an IP address is it could be reflecting the public IP of the network router, not the specific device or computer going through that router.
In this case, all devices and computers running through the same network gateway will share the same public IP address when accessing external servers.
So, if Bob, Vidya, Mary, and Rahul are all on the same WiFi and they all go to your website, your web server will see them all as one user. That would make for a fun experience. 😜👌
+ 5
The only way to persist a cart is to store it somewhere. If you don't store it on the server, then you have to store it locally in the browser.
If you want to store the cart info on the browser without logging in, you will have to store a session id of some sort in your browser.
If you don't want to use any local storage or cookie, then you have no reliable options available. Using IP would be a horrible idea.
Why are you avoiding cookie or local storage?
+ 4
Prince Raj I need further clarification regarding your scenario.
In your question, you wrote:
"I... wanna uniquely identify shop cart item of different browser... without any... login..."
What do you mean when you wrote "of different browser?"
Are you trying to find a way to track an anonymous user across different browsers so the items added to the cart on one computer or browser will automatically appear when viewed from a different computer or browser?
If so, then, you can only achieve this with an authenticated session to allow saving cart items on the server.
+ 4
David Carroll it was my fault to avoid web storage...
+ 3
Like all other proper online shopping sites, the only way is to construct a database which stores your user credentials and provide the option to allow users to register and login using those credentials.
+ 3
Prince Raj You sound like you need a desktop application to communicate with the server to handle what you are trying to achieve, i.e. offline operations and synchronization upon being connected to the net. The browser alone, given your restrictions, cannot achieve that.
Either way, you can always assign unique identifiers to users without relying on IP address information. With a desktop app, that can be your "product key", "user ID", etc which can be stored and accessed offline.
+ 2
\•/ not at all
+ 1
+ 1
Hatsy Rei I haven't problem in store data in database, I can do these all using session login but I want rather than this all is there any another way to uniquely identity shopping cart item of user when they aren't login to my site... Please read my description first...
+ 1
Hatsy Rei I just want e-commerce website available for all not a offline application just to serve add to cart option to user though to provide this i have option of either i use web storage to store data direct to ip of computer or cookies when user didn't get login to my website with their account to uniquely identify their product I can proceed with web storage that will be fine but I am finding another option rather than this, actually don't want to use js, is there any other option? One idea get stuck into my mind to pick user ip address with php to make user ip address as primary key to uniquely identify shopping cart item but this will be not good idea because on switching of isp(internet service provider) ip will change then I will not be able to uniquely identify as ip get change... So I want another option rather than this all is there any other option?
+ 1
David Carroll I thought I should leave the idea of not using web storage or not using js... It's little bit will be tricky but will be fine do you think public IP will not be changed on switching isp?
+ 1
Are you thinking of decentralized application?
0
David Carroll my question is very simple may be answer is hard,
As Amazon like e-commerce website serve add to cart option when you are not login to their site and when you added item into cart from any browser of you choice you will find you particular item that you had added still remain when you reopen again the browser, in scenario of login your cart item move to your session... and you can view your item wherever you login to your account... My problem is before any login how to uniquely identity cart item of user?