使用 Javascript 读取会话 ID

问题描述:

是否可以通过javascript读取浏览器会话ID?

Is it by any means possible to read the browser session id using javascript?

是的.由于会话 ID 通过 URL (document.location.href) 或通过 cookie (document.cookie) 传输,您可以检查两者是否存在会话 ID.

Yes. As the session ID is either transported over the URL (document.location.href) or via a cookie (document.cookie), you could check both for the presence of a session ID.