john_zakaria — 2013-10-21T07:05:49-04:00 — #1
dear everyone i have a big problem while using session and clicking right click open in new tab
consider this problem
In step 1 i select a product i am storing $_SESSION['product_id'] = 55;
step 2 i go to other products with id = 88 and opens another product in a new tab.
Now moves to that tab It's now step 1 for the product2
Now $_SESSION['id'] is set 88
User moves tab 1 and continues to step 3
But now $_SESSION['id'] = 88 and not 55
How can i prevent this. This is a cooked up problem so would like a generalized solution.
lemon_juice — 2013-10-21T08:26:24-04:00 — #2
If you are using cookies to store session ID (the most common scenario) then there's no way to prevent this because that's the nature of cookies that they are shared among all open windows and tabs that contain the same web site. If you want separate sets of data to persist across different tabs then you need to switch from cookies to some other mechanism. Some ideas:
Pass the data you want to persist in the URL of the page. Or, you can create a separate session for each tab but then you have to pass session ID in the URL. For this you'll have to dynamically create links on your page, of course.
system — 2014-10-08T01:02:19-04:00 — #3
This topic is now closed. New replies are no longer allowed.