Is it possible to close the ASP
session when opening a new tab?
I'm trying to shut down the ASP session when the user opens another tab and tries to access the system, the idea is that the system can only be accessed by a tab, if the user tries to open in another tab, wipe all sessions of ASP
.
I tried to use JS
with localStorage
to block this, but it did not work (does not execute)
response.write "<script>"
response.write "var url = window.location.href; "
response.write "var key = Math.floor((Math.random() * 999999999) + 1); "
response.write "if(!localStorage.session){ localStorage.setItem('session', key) }else{ window.location.href = 'MultiplasSecoes.asp'}; "
response.write "if(!localStorage.url){ localStorage.setItem('url', url) };"
response.write "alert(localStorage.session) "
response.write "</script>"
I've also tried to put in my index
if session("SESSAO_ABERTA") = true then
response.write "<script>"
response.write "location.href = 'MultiplasSecoes.asp';"
response.write "</script>"
else
'response.write "<script>alert()</script>"
session("SESSAO_ABERTA_ECARGO") = true
end if