Javascript Event System - custom-page-loaded

From KickApps API Reference

Jump to: navigation, search

This article pertains to the Javascript Event System. You can refer to our list of Javascript Event System Supported Events to learn what else you can do with our event system.

Contents

Summary

This event is fired when a custom page has been loaded.

Payload Parameters

This event differs from all other events because the payload parameters that are passed to your callback function are not concretely defined. Instead, the parameters are simply forwarded from the URL's query string.

Additional Documentation

Please refer to Blank Page Template documentation for more information.

Execution Interruption

none

Example

function onCustomPageLoaded(data) {
// do something here
console.dir(data)
}
var newEventId = Ka.events.listen('custom-page-loaded', onCustomPageLoaded);

Advanced Example

The following example applies to a custom page with the following URL:
http://affiliate.kickapps.com/service/openCustomPage.kickAction?as=1234&myParam=google&css=googlePage&title=Do%20a%20Google%20Search
In this example, we will choose to display a search engine in an IFrame depending on the value of myParam.
function onCustomPageLoaded(data) {
switch(data.myParam) {
case "google":
// show the google iframe
$j("<iframe />")
.attr("src", "http://www.google.com")
.appendTo("#ka_customPage");
break;
case "bing":
// show the bing iframe
$j("<iframe />")
.attr("src", "http://www.bing.com")
.appendTo("#ka_customPage");
break;
default:
$j("#ka_customPage").html("Oops, this is not a valid page!");
}
}
var newEventId = Ka.events.listen('custom-page-loaded', onCustomPageLoaded);