JavaScript手册 
目录
此参考中包含
的内容
轻松上手
简介
操作符
语句
核心
文档
窗口
表单
浏览器
事件和
事件句柄
LiveWire
数据库服务
进程管理服务
实用工具
全局函数
LiveConnect
的Java包
索引
版权
 
【目录】 【上一页】 【下一页】 【索引】

ssjs_getClientID

Returns the identifier for the client object used by some of JavaScript's client-maintenance techniques.

服务器端函数
实现版本Netscape Server 3.0

语法

ssjs_getClientID()

参数

无。

描述

For some applications, you may want to store information specific to a client/application pair in the project or server objects. In these situations, you need a way to refer uniquely to the client/application pair. JavaScript provides two functions for this purpose, ssjs_generateClientID and ssjs_getClientID.

Each time you call ssjs_generateClientID, the runtime engine returns a new identifier. For this reason, if you use this function and want the identifier to last longer than a single client request, you need to store the identifier, possibly as a property of the client object.

If you use this function and store the ID in the client object, you may need to be careful that an intruder cannot get access to that ID and hence to sensitive information.

An alternative approach is to use the ssjs_getClientID function. If you use one of the server-side maintenance techniques for the client object, the JavaScript runtime engine generates and uses a identifier to access the information for a particular client/application pair.

When you use these maintenance techniques, ssjs_getClientID returns the identifier used by the runtime engine. Every time you call this function from a particular client/application pair, you get the same identifier. Therefore, you do not need to store the identifier returned by ssjs_getClientID. However, if you use any of the other maintenance techniques, this function returns "undefined"; if you use those techniques you must instead use the ssjs_generateClientID function.

If you need an identifier and you're using a server-side maintenance technique, you probably should use the ssjs_getClientID function. If you use this function, you do not need to store and track the identifier yourself; the runtime engine does it for you. However, if you use a client-side maintenance technique, you cannot use the ssjs_getClientID function; you must use the ssjs_generateClientID function.


【目录】 【上一页】 【下一页】 【索引】

回页面顶部