Rahul Shinde
Rahul Shinde

Reputation: 11

How to avoid opening same url link in browser in asp.net/javascript/jquery?

I have below scenario

1)Customer login to my website,
2)then he opened new page and added information on that.
3)Before saving the information of that page, he copied the URL and paste on another tab of same browser and enter the information.
4)again he come back to first tab and save the data, we are using session to save the data, so it is conflicted with another tab.

What i want is to prevent user to open same URL in different tab.

We have tried with Hidden field <asp:HiddenField runat="server" ID="hfId" value="" /> to solve the problem and it is working, but we don't know its right or wrong?, Please suggest.

Like bank websites, If we tried to copy URL after logged in into different tabs then it's session expired.

Please give us direction.

Upvotes: 1

Views: 955

Answers (1)

Amol Shiledar
Amol Shiledar

Reputation: 393

using session you can handle data on control center

but if you Local Storage of browser then you can manage this Thing

if user open same URL in diff tab you can set flag and implement your login

for get flag value window.localStorage.getItem('flag')

for set flag value window.localStorage.setItem('flag',<value>)

using this you can check when same url open in new tab you can set logic

Upvotes: 1

Related Questions