Friday, April 16, 2010

Web Client – Passing custom attributes to api.html

Typically api.html page is displayed in an iFrame. Based on your needs you can pass custom attributes to api.html based on your requirements.

In this article we pass visitor location (custom attribute) to the api.html.


1.    Append custom attribute (location)  to the api.html page URL
2.    Update api.html page source to retrieve value of custom attribute (i.e. location).
Add the following lines in the HTML body tag:

//declare a JavaScript variable and assign it value of the custom attribute
var visitorlocation = getParameter('location',url);
//get rid of escape characters
visitorlocation = myunescape(visitorlocation);

Now the visitorlocation JavaScript variable can be used as per your business logic.

No comments: