232 CardSpace Implementation
Scripting CardSpace
In addition to being used in a static HTML tag, CardSpace can
be invoked from a script running in the Web page. Calling
CardSpace from a script enables the website??™s requirements to
be set dynamically. Scripts also support richer error handling
and make it easier to detect client-side support for Information
Cards. In this section, we cover how to call CardSpace with a
script, including error handling. Chapter 5, ???Guidance for a
Relying Party,??? goes into deployment details, such as detecting
client-side support.
The following example requests the same token as the previous
HTML and XHTML examples. The big difference is the Submit
button and Information Card object are not in the form. When
the button is clicked, the script dynamically sets the requested
issuer and claims types on the object. The object is then invoked
by calling the Value property. When this property is
called, CardSpace opens. The script then sets the properties
return value, which is the resulting token, on the hidden input
element in the form, which is posted to the processing page.
CardSpace can be
called directly from
a script
Why Dynamically Set Site Requirements?
It might seem odd at ?¬?rst that there would be cases where setting the site requirements
would be useful.
Pages:
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355