最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to detect some unique browser instance number, or pid number per "window" or per "ta

programmeradmin1浏览0评论

I'm writing a web app, and I have the classic problem that the session cookie is shared between browser instances, and browser tabs. Obviously the browser doesn't send back anything the header. However I am able to control all the requests inside the app, so I'm wondering if I can add my own "parameter".

So the question is, is there some JavaScript which might identify the process ID, or Instance ID, or Tab ID on the client side? I can take care of sending it to the server, but I'm wondering if anyone knows of any tricks on the browser side.

Browser-specific suggestions are wele - I'm very happy with answers that will only work in one browser type.

I'm writing a web app, and I have the classic problem that the session cookie is shared between browser instances, and browser tabs. Obviously the browser doesn't send back anything the header. However I am able to control all the requests inside the app, so I'm wondering if I can add my own "parameter".

So the question is, is there some JavaScript which might identify the process ID, or Instance ID, or Tab ID on the client side? I can take care of sending it to the server, but I'm wondering if anyone knows of any tricks on the browser side.

Browser-specific suggestions are wele - I'm very happy with answers that will only work in one browser type.

Share Improve this question asked Jul 1, 2011 at 7:45 BruceBruce 9113 gold badges7 silver badges12 bronze badges 2
  • You might want to look into sessionStorage. That is like localStorage but:"Opening a page in a new tab or window will cause a new session to be initiated, which differs from how session cookies work." See: developer.mozilla/de/docs/Web/API/Window/sessionStorage – Michael Commented Oct 16, 2015 at 7:28
  • Btw, did you find another solution for your problem? – Michael Commented Oct 16, 2015 at 7:29
Add a ment  | 

2 Answers 2

Reset to default 4

Here is the list of information you can get from javascript: Information about your Web Browser from Javascript. I don't think you can get system specific information like PIDs from javascript, it would certainly be a security issue.

sessionStorage might help you here.

http://www.nczonline/blog/2009/07/21/introduction-to-sessionstorage/

update: window.name can be used.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论